kubernetes calico 启动异常,无法访问etcd
1.calico 配置文件为/etc/calico.yaml
2.配置更新,使用下面的脚本【endpoints使用https】
# ETCD 地址 ETCD_ENDPOINTS="https://server117:2379" sed -i "s#.*etcd_endpoints:.*# etcd_endpoints: \"${ETCD_ENDPOINTS}\"#g" /etc/calico.yaml sed -i "s#__ETCD_ENDPOINTS__#${ETCD_ENDPOINTS}#g" /etc/calico.yaml # ETCD 证书信息 ETCD_CA=`cat /etc/kubernetes/pki/etcd/ca.crt | base64 | tr -d '\n'` ETCD_CERT=`cat /etc/kubernetes/pki/etcd/server.crt | base64 | tr -d '\n'` ETCD_KEY=`cat /etc/kubernetes/pki/etcd/server.key | base64 | tr -d '\n'` # 替换修改 sed -i "s#.*etcd-ca:.*# etcd-ca: ${ETCD_CA}#g" /etc/calico.yaml sed -i "s#.*etcd-cert:.*# etcd-cert: ${ETCD_CERT}#g" /etc/calico.yaml sed -i "s#.*etcd-key:.*# etcd-key: ${ETCD_KEY}#g" /etc/calico.yaml sed -i 's#.*etcd_ca:.*# etcd_ca: "/calico-secrets/etcd-ca"#g' /etc/calico.yaml sed -i 's#.*etcd_cert:.*# etcd_cert: "/calico-secrets/etcd-cert"#g' /etc/calico.yaml sed -i 's#.*etcd_key:.*# etcd_key: "/calico-secrets/etcd-key"#g' /etc/calico.yaml sed -i "s#__ETCD_CA_CERT_FILE__#/etc/kubernetes/pki/etcd/ca.crt#g" /etc/calico.yaml sed -i "s#__ETCD_CERT_FILE__#/etc/kubernetes/pki/etcd/server.crt#g" /etc/calico.yaml sed -i "s#__ETCD_KEY_FILE__#/etc/kubernetes/pki/etcd/server.key#g" /etc/calico.yaml sed -i "s#__KUBECONFIG_FILEPATH__#/etc/cni/net.d/calico-kubeconfig#g" /etc/calico.yaml