Kubernetes pod 内获取所在节点IP

etcdctl --endpoints=https://10.0.23.72:2379,https://10.0.23.83:2379,https://10.0.23.87:2379 --cert-file=/etc/ssl/k8s/etcd.pem --key-file=/etc/ssl/k8s/etcd-key.pem --ca-file=/etc/ssl/k8s/etcd-root-ca.pem  get /kube-centos/network/subnets/10.252.9.0-24 |sed 's/.*"PublicIP":"\([^"]\+\)".*/\1/'

注: 10.252.9.0 是容器IP所在的网段,比较容易获得

你可能感兴趣的:(kubernetes)