刚搞懂了 Kubernetes 的 Service 和 Deployment 之间关系,原来 Pod 副本变化的时候,Deployment 会自动调度,Service 也跟着更新 endpoints... 还是太菜了,之前还以为自己懂了呢
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.19
登录/注册