apiVersion: v1 kind: Namespace metadata: name: reverse-proxy --- apiVersion: apps/v1 kind: Deployment metadata: name: reverse-proxy namespace: reverse-proxy annotations: reloader.stakater.com/search: "true" spec: replicas: 1 selector: matchLabels: app: reverse-proxy template: metadata: labels: app: reverse-proxy spec: nodeName: kube-master containers: - image: nginx:alpine imagePullPolicy: IfNotPresent name: reverse-proxy ports: - containerPort: 80 name: rp-port-http - containerPort: 443 name: rp-port-https volumeMounts: # - name: reverse-proxy-conf # mountPath: /etc/nginx/conf.d/ - name: nginx-sites-terraform mountPath: /etc/nginx/conf.d/ - name: reverse-proxy-ssl mountPath: /etc/nginx/ssl/ #try to chnage from static file to confimap # - mountPath: /etc/nginx/nginx.conf # name: nginx-configfile-volume - mountPath: /etc/nginx/ name: nginx-configfile # - name: reverse-proxy-www # mountPath: /var/www/certbot/ - name: proxy-cache-path-volume mountPath: /tmp/cache/ - name: secret-htpasswd mountPath: /authentication-htpasswd/ resources: limits: cpu: 250m memory: 250Mi volumes: # - name: reverse-proxy-conf # hostPath: # path: /opt/kubernetes/Reverse_proxy_Nginx/conf.d # - name: reverse-proxy-www # hostPath: # path: /opt/kubernetes/Reverse_proxy_Nginx/certbot/www/ - name: reverse-proxy-ssl hostPath: path: /opt/kubernetes/Reverse_proxy_Nginx/certbot/conf/ # - hostPath: # path: /opt/kubernetes/Reverse_proxy_Nginx/nginx.conf # type: File # name: nginx-configfile-volume - name: nginx-configfile configMap: name: nginx-config defaultMode: 0555 - name: nginx-sites-terraform configMap: name: sites-terraform defaultMode: 0555 # - name: nginx-configfile-volume # hostPath: # path: /opt/kubernetes/Reverse_proxy_Nginx/nginx.conf # directory location on host # type: File # this field is optional # - name: nginx-configfile-volume # configMap: # name: nginx-config # defaultMode: 0555 - name: proxy-cache-path-volume emptyDir: medium: Memory - name: secret-htpasswd secret: secretName: htpasswd --- apiVersion: v1 kind: Service metadata: name: reverse-proxy namespace: reverse-proxy spec: externalTrafficPolicy: Local ports: - name: http port: 80 targetPort: rp-port-http protocol: TCP nodePort: 30080 - name: https port: 443 targetPort: rp-port-https protocol: TCP nodePort: 30443 type: NodePort selector: app: reverse-proxy