实用 yaml 片段

最简单的 nginx 测试服务

  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: nginx
  5. spec:
  6. replicas: 1
  7. selector:
  8. matchLabels:
  9. app: nginx
  10. template:
  11. metadata:
  12. labels:
  13. app: nginx
  14. spec:
  15. containers:
  16. - name: nginx
  17. image: nginx
  18. ---
  19. apiVersion: v1
  20. kind: Service
  21. metadata:
  22. name: nginx
  23. labels:
  24. app: nginx
  25. spec:
  26. type: ClusterIP
  27. ports:
  28. - port: 80
  29. protocol: TCP
  30. name: http
  31. selector:
  32. app: nginx