我正在尝试在部署时将静态IP地址分配给Pod。
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: aws-test-mysql
spec:
replicas: 1
template:
metadata:
labels:
app: aws-test-mysql
spec:
containers:
- name: aws-test-mysql
image: 461677341235123.dkr.ecr.us-east-1.amazonaws.com/aws-test-mysql
securityContext:
privileged: true
ports:
- containerPort: 3306
hostIP: 172.20.32.50
hostPort: 3306
resources:
requests:
cpu: 100m
imagePullSecrets:
- name: ecrkey
Run Code Online (Sandbox Code Playgroud)
如您所见,当我描述我的Pod时,它是用另一个IP创建的。
test-mbp1:aws test$ kubectl describe pods | grep IP
IP: 100.96.1.3
Run Code Online (Sandbox Code Playgroud)
我正在尝试在“种类:部署”而不是服务上部署具有静态IP的Pod。
这可行吗?