linux shell 获取本机ip
本机IP获取/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"k8s 获取容器所造node节点的ipcontainer_net=`ifconfig eth0 |grep "inet" |grep -v "inet6&qu
·
本机IP获取
/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"
k8s 获取容器所造node节点的ip
container_net=`ifconfig eth0 |grep "inet" |grep -v "inet6"| awk '{print $2}'|cut -d '.' -f 3`
node_ip=`etcdctl --endpoints=https://10.0.13.78:2379,https://10.0.13.80:2379,https://10.0.13.81:2379 --cert-file=/home/yanfa/cert/etcd.pem --key-file=/home/yanfa/cert/etcd-key.pem --ca-file=/home/yanfa/cert/etcd-root-ca.pem get /kube-centos/network/subnets/10.252.${container_net}.0-24 |sed 's/.*"PublicIP":"\([^"]\+\)".*/\1/' `
更多推荐
已为社区贡献7条内容
所有评论(0)