我正在用 minikube + calico 插件做一些测试,看看我是否可以在创建 pod 时设置 pod IP。
我打开了 minikube 代理并发送了:
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"name": "pod2",
"annotations": {
"cni.projectcalico.org/ipAddrs": "[\"172.18.0.50\"]"
}
},
"spec": {
"containers": [
{
"name": "hello-node",
"image": "k8s.gcr.io/echoserver:1.4",
"ports": [
{
"containerPort": 8081
}
]
}
]
}
}
但似乎注释被忽略了。pod 是使用另一个 IP 创建的:
NAME READY STATUS RESTARTS AGE IP NODE
pod1 1/1 Running 0 36s 172.18.0.8 minikube
pod2 1/1 Running 0 6s 172.18.0.9 minikube
我检查了10-calico.conflist
文件,插件设置为使用calico-ipam
.
我错过了什么?
编辑:印花布版本:
Client Version: v3.14.0
Git commit: c97876ba
Cluster Version: v3.14.0
Cluster Type: k8s,kdd,bgp,kubeadm
输出kubectl get po --all-namespaces -o wide
:
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default hello-minikube-64b64df8c9-fd5vz 1/1 Running 1 70m 172.18.0.7 minikube <none> <none>
default pod1 1/1 Running 0 67m 172.18.0.8 minikube <none> <none>
default pod2 1/1 Running 0 66m 172.18.0.9 minikube <none> <none>
kube-system calico-kube-controllers-789f6df884-msvzm 1/1 Running 2 152m 172.18.0.6 minikube <none> <none>
kube-system calico-node-5l2vm 1/1 Running 1 152m 172.17.0.2 minikube <none> <none>
kube-system calicoctl 1/1 Running 1 121m 172.17.0.2 minikube <none> <none>
kube-system coredns-66bff467f8-8hmpv 1/1 Running 3 28h 172.18.0.5 minikube <none> <none>
kube-system coredns-66bff467f8-xwrpj 1/1 Running 3 28h 172.18.0.3 minikube <none> <none>
kube-system etcd-minikube 1/1 Running 2 27h 172.17.0.2 minikube <none> <none>
kube-system kube-apiserver-minikube 1/1 Running 2 27h 172.17.0.2 minikube <none> <none>
kube-system kube-controller-manager-minikube 1/1 Running 3 28h 172.17.0.2 minikube <none> <none>
kube-system kube-proxy-wq29b 1/1 Running 3 28h 172.17.0.2 minikube <none> <none>
kube-system kube-scheduler-minikube 1/1 Running 3 28h 172.17.0.2 minikube <none> <none>
kube-system storage-provisioner 1/1 Running 5 28h 172.17.0.2 minikube <none> <none>
kubernetes-dashboard dashboard-metrics-scraper-84bfdf55ff-kj4t2 1/1 Running 3 28h 172.18.0.4 minikube <none> <none>
kubernetes-dashboard kubernetes-dashboard-696dbcc666-qxc78 1/1 Running 5 28h 172.18.0.2 minikube <none> <none>