mysql-services.yaml 587 B

1234567891011121314151617181920212223242526272829303132
  1. # Headless service for stable DNS entries of StatefulSet members.
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: mysql
  6. namespace: my-statefulset
  7. labels:
  8. app: mysql
  9. spec:
  10. ports:
  11. - name: mysql
  12. port: 3306
  13. clusterIP: None
  14. selector:
  15. app: mysql
  16. ---
  17. # Client service for connecting to any MySQL instance for reads.
  18. # For writes, you must instead connect to the primary: mysql-0.mysql.
  19. apiVersion: v1
  20. kind: Service
  21. metadata:
  22. name: mysql-read
  23. namespace: my-statefulset
  24. labels:
  25. app: mysql
  26. spec:
  27. ports:
  28. - name: mysql
  29. port: 3306
  30. selector:
  31. app: mysql