nginx-deployment.yaml 863 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: nginx-deployment
  5. labels:
  6. app: nginx
  7. spec:
  8. replicas: 3
  9. selector:
  10. matchLabels:
  11. app: nginx
  12. template:
  13. metadata:
  14. labels:
  15. app: nginx
  16. spec:
  17. containers:
  18. - name: nginx
  19. image: registry.cn-hangzhou.aliyuncs.com/zhongpengqun/wanderer:linux-amd64-nginx-stable-alpine-3.23
  20. ports:
  21. - containerPort: 80
  22. resources:
  23. requests:
  24. memory: "64Mi"
  25. cpu: "250m"
  26. limits:
  27. memory: "128Mi"
  28. cpu: "500m"
  29. ---
  30. apiVersion: v1
  31. kind: Service
  32. metadata:
  33. name: nginx-service
  34. spec:
  35. selector:
  36. app: nginx
  37. ports:
  38. - port: 80 # 集群内部访问端口
  39. targetPort: 80 # 容器端口
  40. nodePort: 30637 # 必须在 30000~32767 之间
  41. type: NodePort # 外网访问类型