Headless Services
Provide stable DNS for StatefulSets without load balancing.
A headless Service has no ClusterIP. It returns DNS records for each Pod, which is ideal for StatefulSets.
Typical use
- Databases that need stable Pod addresses
- Replication setups that target specific instances
Example
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
clusterIP: None
selector:
app: mysql
ports:
- port: 3306
targetPort: 3306
After creation you can reach:
mysql-0.mysql.default.svc.cluster.local
Practical notes
- Start with a quick inventory:
kubectl get nodes,kubectl get pods -A, andkubectl get events -A. - Compare desired vs. observed state;
kubectl describeusually explains drift or failed controllers. - Keep names, labels, and selectors consistent so Services and controllers can find Pods.
Quick checklist
- The resource matches the intent you described in YAML.
- Namespaces, RBAC, and images are correct for the target environment.
- Health checks and logs are in place before promotion.