nginx-https-deploy.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: nginx-https
  5. spec:
  6. replicas: 1
  7. selector:
  8. matchLabels:
  9. app: nginx-https
  10. template:
  11. metadata:
  12. labels:
  13. app: nginx-https
  14. spec:
  15. containers:
  16. - name: nginx-https
  17. image: nginx
  18. ports:
  19. - name: web
  20. containerPort: 80
  21. - name: secureweb
  22. containerPort: 443
  23. volumeMounts:
  24. - name: nginx-https-cm
  25. mountPath: /etc/nginx
  26. - name: nginx-https-secret
  27. mountPath: /etc/nginx/ssl
  28. readOnly: true
  29. - name: nginx-https-vol
  30. mountPath: /usr/share/nginx/html
  31. volumes:
  32. - name: nginx-https-cm
  33. configMap:
  34. name: nginx-https-cm
  35. - name: nginx-https-secret
  36. secret:
  37. secretName: nginx-https-secret
  38. - name: nginx-https-vol
  39. hostPath:
  40. path: /var/nginxserver
  41. ---
  42. apiVersion: v1
  43. kind: ConfigMap
  44. metadata:
  45. name: nginx-https-cm
  46. data:
  47. nginx.conf: |
  48. user nginx;
  49. worker_processes 1;
  50. events {
  51. worker_connections 10240;
  52. }
  53. http {
  54. server {
  55. listen 80;
  56. listen 443 ssl;
  57. server_name _;
  58. ssl_certificate /etc/nginx/ssl/server-cert.pem;
  59. ssl_certificate_key /etc/nginx/ssl/server-key.pem;
  60. location / {
  61. root /usr/share/nginx/html;
  62. index index.html index.htm;
  63. }
  64. }
  65. }