{"id":25565951,"url":"https://github.com/anande/gitops","last_synced_at":"2026-05-05T23:31:13.705Z","repository":{"id":273227883,"uuid":"919053486","full_name":"anande/GitOps","owner":"anande","description":"journey towards self hosting opensource gitops tech","archived":false,"fork":false,"pushed_at":"2025-02-19T16:10:03.000Z","size":3899,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-19T17:24:13.590Z","etag":null,"topics":["argo","cert-manager","crossplane","excalidraw","gitea","gitea-actions","grafana","harbor","helm","keycloa","kubernetes","kustomize","loki","metallb","minio","nginx","prometheus"],"latest_commit_sha":null,"homepage":"","language":"Smarty","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anande.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-19T15:39:29.000Z","updated_at":"2025-02-19T16:10:07.000Z","dependencies_parsed_at":"2025-02-12T10:40:03.837Z","dependency_job_id":"8b4a7564-5944-4def-8551-b79fdafea0da","html_url":"https://github.com/anande/GitOps","commit_stats":null,"previous_names":["anande/gitops"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anande%2FGitOps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anande%2FGitOps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anande%2FGitOps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anande%2FGitOps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anande","download_url":"https://codeload.github.com/anande/GitOps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239922483,"owners_count":19718969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argo","cert-manager","crossplane","excalidraw","gitea","gitea-actions","grafana","harbor","helm","keycloa","kubernetes","kustomize","loki","metallb","minio","nginx","prometheus"],"created_at":"2025-02-20T22:21:20.457Z","updated_at":"2026-03-15T05:30:18.937Z","avatar_url":"https://github.com/anande.png","language":"Smarty","funding_links":[],"categories":[],"sub_categories":[],"readme":"To configure two services in different namespaces within the same k3d cluster to use Traefik as an Ingress controller, while ensuring they have different external IPs, follow these steps:\n\n## Overview\n\nTraefik typically uses a LoadBalancer service type, which may assign the same external IP to multiple services if they share the same Ingress class and configuration. To achieve distinct external IPs for different services, you can utilize MetalLB in conjunction with Traefik to manage multiple external IPs.\n\n## Step-by-Step Guide\n\n### Step 1: Install MetalLB\n\n1. **Install MetalLB**:\n   First, you need to install MetalLB in your k3d cluster. You can do this by applying the MetalLB manifest:\n\n   ```bash\n   kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/manifests/namespace.yaml\n   kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/manifests/metallb.yaml\n   ```\n\n2. **Configure MetalLB**:\n   Create a ConfigMap for MetalLB to define the IP address pool it can use. Replace `\u003cIP_RANGE\u003e` with a range of IPs you want to allocate (e.g., `192.168.1.200-192.168.1.250`).\n\n   ```yaml\n   apiVersion: v1\n   kind: ConfigMap\n   metadata:\n     namespace: metallb-system\n     name: config\n   data:\n     config: |\n       layer2:\n         addresses:\n           - \u003cIP_RANGE\u003e\n   ```\n\n   Apply this configuration:\n   ```bash\n   kubectl apply -f your-configmap.yaml\n   ```\n\n### Step 2: Configure Traefik with Multiple Services\n\n1. **Create Ingress Resources**:\n   Create separate Ingress resources for each service in their respective namespaces, specifying different hostnames.\n\n   Example for Service 1 (`service1.yaml`):\n   ```yaml\n   apiVersion: networking.k8s.io/v1\n   kind: Ingress\n   metadata:\n     name: service1-ingress\n     namespace: namespace1\n     annotations:\n       kubernetes.io/ingress.class: \"traefik\"\n   spec:\n     rules:\n       - host: service1.local\n         http:\n           paths:\n             - path: /\n               pathType: Prefix\n               backend:\n                 service:\n                   name: service1\n                   port:\n                     number: 80\n     tls:\n       - hosts:\n           - service1.local\n         secretName: service1-tls-secret  # Ensure you have created this TLS secret if needed.\n   ```\n\n   Example for Service 2 (`service2.yaml`):\n   ```yaml\n   apiVersion: networking.k8s.io/v1\n   kind: Ingress\n   metadata:\n     name: service2-ingress\n     namespace: namespace2\n     annotations:\n       kubernetes.io/ingress.class: \"traefik\"\n   spec:\n     rules:\n       - host: service2.local\n         http:\n           paths:\n             - path: /\n               pathType: Prefix\n               backend:\n                 service:\n                   name: service2\n                   port:\n                     number: 80\n     tls:\n       - hosts:\n           - service2.local\n         secretName: service2-tls-secret  # Ensure you have created this TLS secret if needed.\n   ```\n\n### Step 3: Assign External IPs\n\nTo assign different external IPs to each Ingress resource, modify the Traefik service to use specific external IPs.\n\n1. **Edit Traefik Service**:\n\n```yaml\napiVersion: v1\nkind: Service\nmetadata:\n  name: traefik-service\n  namespace: kube-system  # Adjust based on your setup.\nspec:\n  type: LoadBalancer\n  selector:\n    app: traefik  # Ensure this matches your Traefik deployment.\n  ports:\n    - port: 80\n      targetPort: 80\n    - port: 443\n      targetPort: 443\n  externalIPs:\n    - \u003cEXTERNAL_IP_FOR_SERVICE_1\u003e\n    - \u003cEXTERNAL_IP_FOR_SERVICE_2\u003e\n```\n\n### Step 4: Update `/etc/hosts`\n\nTo access your services via their hostnames, add entries to your `/etc/hosts` file:\n\n```\n\u003cEXTERNAL_IP_FOR_SERVICE_1\u003e service1.local\n\u003cEXTERNAL_IP_FOR_SERVICE_2\u003e service2.local\n```\n\n### Step 5: Verify Configuration\n\nCheck that both services are accessible via their respective hostnames and that they respond correctly.\n\n```bash\nkubectl get ingress --all-namespaces\n```\n\nThis setup allows you to use Traefik with multiple services in different namespaces while ensuring they have distinct external IPs by leveraging MetalLB's capabilities within your k3d cluster.\n\nCitations:\n[1] https://community.traefik.io/t/using-multiple-traefik-load-balancer-services-with-different-ips/19654\n[2] https://community.traefik.io/t/accessing-the-cluster-with-ingressroute/1809\n[3] https://stackoverflow.com/questions/68547804/how-to-expose-two-apps-services-over-unique-ports-with-k3d\n[4] https://community.traefik.io/t/usage-of-publishedservice-in-externalip-setup/9971\n[5] https://forums.rancher.com/t/running-k3s-with-traefik-on-a-second-entwork-interface/39163\n[6] https://k3d.io/v5.1.0/usage/exposing_services/\n[7] https://github.com/k3d-io/k3d/issues/960\n[8] https://docs.rancherdesktop.io/how-to-guides/traefik-ingress-example/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanande%2Fgitops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanande%2Fgitops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanande%2Fgitops/lists"}