Advertisement
andrejsstepanovs

nginx ingress example

Dec 10th, 2021
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: apple
  5. namespace: default
  6. labels:
  7. app: appledeployment
  8. spec:
  9. progressDeadlineSeconds: 600
  10. replicas: 1
  11. revisionHistoryLimit: 10
  12. selector:
  13. matchLabels:
  14. app: apple
  15. strategy:
  16. rollingUpdate:
  17. maxSurge: 25%
  18. maxUnavailable: 25%
  19. type: RollingUpdate
  20. template:
  21. metadata:
  22. labels:
  23. app: apple
  24. spec:
  25. containers:
  26. - image: wormhit/nginx-test-static:2.0
  27. name: apple
  28. imagePullPolicy: IfNotPresent
  29. lifecycle:
  30. preStop:
  31. exec:
  32. command:
  33. - /bin/sh
  34. - -c
  35. - sleep 5; /usr/local/openresty/nginx/sbin/nginx -c /etc/nginx/nginx.conf
  36. -s quit; while pgrep -x nginx; do sleep 1; done
  37. livenessProbe:
  38. failureThreshold: 3
  39. httpGet:
  40. path: /
  41. port: 80
  42. scheme: HTTP
  43. initialDelaySeconds: 15
  44. periodSeconds: 30
  45. successThreshold: 1
  46. timeoutSeconds: 1
  47. readinessProbe:
  48. failureThreshold: 3
  49. httpGet:
  50. path: /
  51. port: 80
  52. scheme: HTTP
  53. initialDelaySeconds: 5
  54. periodSeconds: 30
  55. successThreshold: 1
  56. timeoutSeconds: 1
  57. startupProbe:
  58. failureThreshold: 3
  59. httpGet:
  60. path: /
  61. port: 80
  62. scheme: HTTP
  63. periodSeconds: 5
  64. successThreshold: 1
  65. timeoutSeconds: 1
  66. ports:
  67. - containerPort: 80
  68. name: http
  69. protocol: TCP
  70. resources: {}
  71. dnsPolicy: ClusterFirst
  72. restartPolicy: Always
  73. schedulerName: default-scheduler
  74. securityContext: {}
  75. terminationGracePeriodSeconds: 30
  76. ---
  77. apiVersion: v1
  78. kind: Service
  79. metadata:
  80. name: apple
  81. namespace: default
  82. labels:
  83. app: appleservice
  84. spec:
  85. type: ClusterIP
  86. ports:
  87. - port: 80
  88. selector:
  89. app: apple
  90. ---
  91. apiVersion: networking.k8s.io/v1
  92. kind: Ingress
  93. metadata:
  94. name: apple
  95. annotations:
  96. kubernetes.io/ingress.class: nginx
  97. nginx.ingress.kubernetes.io/ssl-redirect: "false"
  98.  
  99. spec:
  100. rules:
  101. - host: "andrejs.apple.dev"
  102. http:
  103. paths:
  104. - path: /
  105. pathType: Prefix
  106. backend:
  107. service:
  108. name: apple
  109. port:
  110. number: 80
  111.  
  112.  
  113. # add to /etc/hosts
  114. kubectl -n ingress-nginx get services | grep 80
  115.  
  116. {IP FROM ABOVE} andrejs.apple.dev
  117.  
  118.  
  119.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement