service.yaml 776 B

1234567891011121314151617181920212223242526272829303132
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: servicename
  5. namespace: namespace
  6. spec:
  7. selector:
  8. app: appname
  9. # ---
  10. # type: ClusterIP
  11. # ClusterIP means this service can be accessed by any pod in the cluster
  12. # ports:
  13. # - name: http
  14. # port: 8080
  15. # targetPort: 80
  16. # protocol: TCP # optional protocol
  17. # ---
  18. # type: NodePort
  19. # NodePort means this service is only accessible by pods in the same namespace
  20. # ports:
  21. # - name: http
  22. # port: 80
  23. # nodePort: 30001
  24. # protocol: TCP # optional protocol
  25. # ---
  26. # type: LoadBalancer
  27. # LoadBalancer means this service is load-balanced across all nodes in the cluster
  28. # ports:
  29. # - name: http
  30. # port: 80
  31. # targetPort: 30001
  32. # protocol: TCP # optional protocol