固定POD IP
固定 POD IP
固定单个 ip
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-test
spec:
selector:
matchLabels:
app: nginx
replicas: 1 # tells deployment to run 1 pods matching the template
template:
metadata:
labels:
app: nginx
annotations:
"cni.projectcalico.org/ipAddrs": "[\"10.42.210.135\"]"
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
固定多个 ip,只能通过 ippool 的方式
cat ippool1.yaml
apiVersion: projectcalico.org/v3
kind: IPPool
metadata:
name: pool-1
spec:
blockSize: 31
cidr: 10.21.0.0/31
ipipMode: Never
natOutgoing: true
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-test
spec:
selector:
matchLabels:
app: nginx
replicas: 1 # tells deployment to run 1 pods matching the template
template:
metadata:
labels:
app: nginx
annotations:
"cni.projectcalico.org/ipv4pools": "[\"pool-1\"]"
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80