From 99610079e72a8b069939ba994137c6b98fa3e057 Mon Sep 17 00:00:00 2001 From: Mans Ziesel Date: Sun, 22 Sep 2024 13:12:27 +0200 Subject: [PATCH] change traefik lb setup --- ip-mziesel-nl/ip-mziesel-nl-ingress.yaml | 15 +++++++++++++ ip-mziesel-nl/ip-mziesel-nl-svc.yaml | 4 +--- traefik/base/002-traefik-services.yaml | 21 +++++------------- traefik/base/002-traefik.yaml | 2 +- whoami/base/whoami-ingress.yaml | 2 +- whoami/base/whoami-svc.yaml | 28 +----------------------- 6 files changed, 25 insertions(+), 47 deletions(-) create mode 100644 ip-mziesel-nl/ip-mziesel-nl-ingress.yaml diff --git a/ip-mziesel-nl/ip-mziesel-nl-ingress.yaml b/ip-mziesel-nl/ip-mziesel-nl-ingress.yaml new file mode 100644 index 0000000..386c58e --- /dev/null +++ b/ip-mziesel-nl/ip-mziesel-nl-ingress.yaml @@ -0,0 +1,15 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ip-mzisel-nl-ingress +spec: + rules: + - http: + paths: + - path: /ip + pathType: Prefix + backend: + service: + name: ip-mziesel-nl + port: + name: web diff --git a/ip-mziesel-nl/ip-mziesel-nl-svc.yaml b/ip-mziesel-nl/ip-mziesel-nl-svc.yaml index 8d38f03..75e7e57 100644 --- a/ip-mziesel-nl/ip-mziesel-nl-svc.yaml +++ b/ip-mziesel-nl/ip-mziesel-nl-svc.yaml @@ -3,10 +3,8 @@ kind: Service metadata: name: ip-mziesel-nl spec: - type: NodePort ports: - - port: 8080 + - port: 80 targetPort: 8080 - nodePort: 31339 selector: app: ip-mziesel-nl diff --git a/traefik/base/002-traefik-services.yaml b/traefik/base/002-traefik-services.yaml index 37b9ecb..4632bb3 100644 --- a/traefik/base/002-traefik-services.yaml +++ b/traefik/base/002-traefik-services.yaml @@ -1,25 +1,16 @@ apiVersion: v1 kind: Service metadata: - name: traefik-dashboard-service + name: traefik-service spec: type: LoadBalancer ports: - - port: 8080 + - name: web + targetPort: web + port: 80 + - name: dashbaord + port: 8080 targetPort: dashboard selector: app: traefik ---- -apiVersion: v1 -kind: Service -metadata: - name: traefik-web-service - -spec: - type: LoadBalancer - ports: - - targetPort: web - port: 80 - selector: - app: traefik diff --git a/traefik/base/002-traefik.yaml b/traefik/base/002-traefik.yaml index 277eb87..ad414df 100644 --- a/traefik/base/002-traefik.yaml +++ b/traefik/base/002-traefik.yaml @@ -22,7 +22,7 @@ spec: args: - --api.insecure - --providers.kubernetesingress - - --providers.kubernetesingress.ingressendpoint.publishedservice=traefik/traefik-web-service + - --providers.kubernetesingress.ingressendpoint.publishedservice=traefik/traefik-service ports: - name: web containerPort: 80 diff --git a/whoami/base/whoami-ingress.yaml b/whoami/base/whoami-ingress.yaml index 4abb1c3..a386e1c 100644 --- a/whoami/base/whoami-ingress.yaml +++ b/whoami/base/whoami-ingress.yaml @@ -10,6 +10,6 @@ spec: pathType: Prefix backend: service: - name: whoami-traefik + name: whoami port: name: web diff --git a/whoami/base/whoami-svc.yaml b/whoami/base/whoami-svc.yaml index 82f1a64..f702ee5 100644 --- a/whoami/base/whoami-svc.yaml +++ b/whoami/base/whoami-svc.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: whoami-nodeport + name: whoami namespace: whoami spec: type: NodePort @@ -11,29 +11,3 @@ spec: nodePort: 31338 selector: app: whoami ---- -apiVersion: v1 -kind: Service -metadata: - name: whoami-loadbalancer - namespace: whoami -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 80 - selector: - app: whoami ---- -apiVersion: v1 -kind: Service -metadata: - name: whoami-traefik - namespace: whoami -spec: - ports: - - name: web - port: 80 - targetPort: 80 - selector: - app: whoami