From e26a5e58b4b9ebf5517a254e408f1843bbe49e49 Mon Sep 17 00:00:00 2001 From: gregory hendrickson Date: Thu, 26 Jan 2023 12:49:56 -0800 Subject: [PATCH] use ingress --- README.md | 2 -- services/LoadBalancer-traefik.yaml | 15 --------- services/ingress-service.yaml | 53 +++++++++++++----------------- 3 files changed, 23 insertions(+), 47 deletions(-) delete mode 100644 services/LoadBalancer-traefik.yaml diff --git a/README.md b/README.md index 3f22bf7..7d9ad36 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,10 @@ kubectl apply -f volumes/traefik-pv.yaml kubectl apply -f volumes/ghost-blog-pv.yaml kubectl apply -f volumes/mysql-pv.yaml - kubectl apply -f volumes/mysql-pvc.yaml kubectl apply -f volumes/traefik-pvc.yaml kubectl apply -f volumes/ghost-blog-pvc.yaml - kubectl apply -f deployments/ghost-blog-deployment.yaml kubectl apply -f deployments/mysql-deployment.yaml kubectl apply -f deployments/traefik-proxy-deployment.yaml diff --git a/services/LoadBalancer-traefik.yaml b/services/LoadBalancer-traefik.yaml deleted file mode 100644 index f61689c..0000000 --- a/services/LoadBalancer-traefik.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: traefik-loadbalancer -spec: - selector: - app: traefik - ports: - - name: http - port: 80 - targetPort: 80 - - name: https - port: 443 - targetPort: 443 - type: LoadBalancer diff --git a/services/ingress-service.yaml b/services/ingress-service.yaml index 8505452..af61559 100644 --- a/services/ingress-service.yaml +++ b/services/ingress-service.yaml @@ -1,36 +1,29 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: ingress-service - namespace: blog + name: ghost-ingress annotations: - nginx.ingress.kubernetes.io/rewrite-target: / - nginx.ingress.kubernetes.io/configuration-snippet: | - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; - proxy_pass_request_headers on; + kubernetes.io/ingress.class: nginx + cert-manager.io/cluster-issuer: letsencrypt-prod spec: rules: - - host: $(VAR_HOST) - http: - paths: - - path: / - pathType: Prefix - pathRewrite: /ghost/ - backend: - service: - name: ghost-blog-service - port: - name: http - path: / - tls: - - hosts: - - $(VAR_HOST) - secretName: $(SECRET_NAME) - - #In the ingress-service.yaml, the "secretName" field is used to specify the name of the Kubernetes Secret object that contains the TLS certificate and key that should be used for the ingress. The ingress controller will use this secret to terminate the HTTPS connection and encrypt the traffic. The value of the "secretName" field should be the name of the secret that contains the certificate and key. - - - + - host: blog.gregattempts.com + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: ghost-blog + port: + number: 80 + - host: blog.gregattempts.com + http: + paths: + - pathType: Prefix + path: "/" + backend: + service: + name: ghost-blog + port: + number: 80 \ No newline at end of file