nginx-deployment-with-ingress-no-class.yaml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. apiVersion: v1
  2. kind: Namespace
  3. metadata:
  4. name: nginx-app
  5. ---
  6. apiVersion: apps/v1
  7. kind: Deployment
  8. metadata:
  9. name: nginx-deployment
  10. namespace: nginx-app
  11. labels:
  12. app: nginx
  13. spec:
  14. replicas: 3
  15. selector:
  16. matchLabels:
  17. app: nginx
  18. template:
  19. metadata:
  20. labels:
  21. app: nginx
  22. spec:
  23. containers:
  24. - name: nginx
  25. image: registry.cn-hangzhou.aliyuncs.com/zhongpengqun/wanderer:linux-amd64-nginx-stable-alpine-3.23
  26. ports:
  27. - containerPort: 80
  28. resources:
  29. requests:
  30. memory: "64Mi"
  31. cpu: "250m"
  32. limits:
  33. memory: "128Mi"
  34. cpu: "500m"
  35. readinessProbe:
  36. httpGet:
  37. path: /
  38. port: 80
  39. initialDelaySeconds: 5
  40. periodSeconds: 5
  41. livenessProbe:
  42. httpGet:
  43. path: /
  44. port: 80
  45. initialDelaySeconds: 10
  46. periodSeconds: 10
  47. ---
  48. apiVersion: v1
  49. kind: Service
  50. metadata:
  51. name: nginx-service
  52. namespace: nginx-app
  53. labels:
  54. app: nginx
  55. spec:
  56. selector:
  57. app: nginx
  58. ports:
  59. - protocol: TCP
  60. port: 80
  61. targetPort: 80
  62. type: ClusterIP
  63. ---
  64. apiVersion: networking.k8s.io/v1
  65. kind: Ingress
  66. metadata:
  67. name: nginx-ingress
  68. namespace: nginx-app
  69. spec:
  70. rules:
  71. - host: 215.9981.tech
  72. http:
  73. paths:
  74. - path: /
  75. pathType: Prefix
  76. backend:
  77. service:
  78. name: nginx-service
  79. port:
  80. number: 80