use ingress

This commit is contained in:
gregory hendrickson
2023-01-26 12:49:56 -08:00
parent c31a9b22f2
commit e26a5e58b4
3 changed files with 23 additions and 47 deletions

View File

@@ -14,12 +14,10 @@ kubectl apply -f volumes/traefik-pv.yaml
kubectl apply -f volumes/ghost-blog-pv.yaml kubectl apply -f volumes/ghost-blog-pv.yaml
kubectl apply -f volumes/mysql-pv.yaml kubectl apply -f volumes/mysql-pv.yaml
kubectl apply -f volumes/mysql-pvc.yaml kubectl apply -f volumes/mysql-pvc.yaml
kubectl apply -f volumes/traefik-pvc.yaml kubectl apply -f volumes/traefik-pvc.yaml
kubectl apply -f volumes/ghost-blog-pvc.yaml kubectl apply -f volumes/ghost-blog-pvc.yaml
kubectl apply -f deployments/ghost-blog-deployment.yaml kubectl apply -f deployments/ghost-blog-deployment.yaml
kubectl apply -f deployments/mysql-deployment.yaml kubectl apply -f deployments/mysql-deployment.yaml
kubectl apply -f deployments/traefik-proxy-deployment.yaml kubectl apply -f deployments/traefik-proxy-deployment.yaml

View File

@@ -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

View File

@@ -1,36 +1,29 @@
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: ingress-service name: ghost-ingress
namespace: blog
annotations: annotations:
nginx.ingress.kubernetes.io/rewrite-target: / kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/configuration-snippet: | cert-manager.io/cluster-issuer: letsencrypt-prod
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;
spec: spec:
rules: rules:
- host: $(VAR_HOST) - host: blog.gregattempts.com
http: http:
paths: paths:
- path: / - pathType: Prefix
pathType: Prefix path: "/"
pathRewrite: /ghost/ backend:
backend: service:
service: name: ghost-blog
name: ghost-blog-service port:
port: number: 80
name: http - host: blog.gregattempts.com
path: / http:
tls: paths:
- hosts: - pathType: Prefix
- $(VAR_HOST) path: "/"
secretName: $(SECRET_NAME) backend:
service:
#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. name: ghost-blog
port:
number: 80