deployment.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: nginx-config
  5. data:
  6. nginx.conf: |
  7. server {
  8. server_name hue;
  9. charset utf-8;
  10. listen 80;
  11. # Or if running hue on https://
  12. ## listen 8001 ssl;
  13. ## ssl_certificate /path/to/ssl/cert;
  14. ## ssl_certificate_key /path/to/ssl/key;
  15. location / {
  16. proxy_pass http://hue:8000;
  17. # Or if the upstream Hue instances are running behind https://
  18. ## proxy_pass https://hue;
  19. }
  20. location /static/ {
  21. alias /usr/share/nginx/html/hue/static/;
  22. expires 30d;
  23. add_header Cache-Control public;
  24. }
  25. }
  26. upstream hue {
  27. ip_hash;
  28. # List all the Hue instances here for high availability.
  29. server hue:8000 max_fails=3;
  30. #server HUE_HOST2:8888 max_fails=3;
  31. }
  32. ---
  33. apiVersion: apps/v1
  34. kind: Deployment
  35. metadata:
  36. name: nginx-deployment
  37. spec:
  38. selector:
  39. matchLabels:
  40. app: nginx
  41. replicas: 1
  42. template:
  43. metadata:
  44. labels:
  45. app: nginx
  46. spec:
  47. containers:
  48. - name: nginx
  49. image: nginx:1.7.9
  50. ports:
  51. - containerPort: 80
  52. volumeMounts:
  53. - name: nginx-config
  54. mountPath: /etc/nginx/nginx.conf
  55. subPath: nginx.conff
  56. volumes:
  57. - name: nginx-config
  58. configMap:
  59. name: nginx-config
  60. ---
  61. apiVersion: v1
  62. kind: Service
  63. metadata:
  64. name: hue-balancer
  65. spec:
  66. type: NodePort
  67. # type: LoadBalancer
  68. selector:
  69. app: nginx
  70. ports:
  71. - protocol: TCP
  72. port: 80
  73. targetPort: 80