Merge pull request #22630 from inductor/feature/update_ha_etcd_adm

Update setup ha etcd with kubeadm
This commit is contained in:
Kubernetes Prow Robot
2020-07-21 20:30:04 -07:00
committed by GitHub
@@ -6,6 +6,14 @@ weight: 70
<!-- overview --> <!-- overview -->
{{< note >}}
While kubeadm is being used as the management tool for external etcd nodes
in this guide, please note that kubeadm does not plan to support certificate rotation
or upgrades for such nodes. The long term plan is to empower the tool
[etcdadm](https://github.com/kubernetes-sigs/etcdadm) to manage these
aspects.
{{< /note >}}
Kubeadm defaults to running a single member etcd cluster in a static pod managed Kubeadm defaults to running a single member etcd cluster in a static pod managed
by the kubelet on the control plane node. This is not a high availability setup by the kubelet on the control plane node. This is not a high availability setup
as the etcd cluster contains only one member and cannot sustain any members as the etcd cluster contains only one member and cannot sustain any members
@@ -52,7 +60,8 @@ this example.
cat << EOF > /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf cat << EOF > /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf
[Service] [Service]
ExecStart= ExecStart=
ExecStart=/usr/bin/kubelet --address=127.0.0.1 --pod-manifest-path=/etc/kubernetes/manifests # Replace "systemd" with the cgroup driver of your container runtime. The default value in the kubelet is "cgroupfs".
ExecStart=/usr/bin/kubelet --address=127.0.0.1 --pod-manifest-path=/etc/kubernetes/manifests --cgroup-driver=systemd
Restart=always Restart=always
EOF EOF
@@ -81,7 +90,7 @@ this example.
HOST=${ETCDHOSTS[$i]} HOST=${ETCDHOSTS[$i]}
NAME=${NAMES[$i]} NAME=${NAMES[$i]}
cat << EOF > /tmp/${HOST}/kubeadmcfg.yaml cat << EOF > /tmp/${HOST}/kubeadmcfg.yaml
apiVersion: "kubeadm.k8s.io/v1beta1" apiVersion: "kubeadm.k8s.io/v1beta2"
kind: ClusterConfiguration kind: ClusterConfiguration
etcd: etcd:
local: local:
@@ -241,15 +250,17 @@ this example.
```sh ```sh
docker run --rm -it \ docker run --rm -it \
--net host \ --net host \
-v /etc/kubernetes:/etc/kubernetes quay.io/coreos/etcd:${ETCD_TAG} etcdctl \ -v /etc/kubernetes:/etc/kubernetes k8s.gcr.io/etcd:${ETCD_TAG} etcdctl \
--cert-file /etc/kubernetes/pki/etcd/peer.crt \ --cert /etc/kubernetes/pki/etcd/peer.crt \
--key-file /etc/kubernetes/pki/etcd/peer.key \ --key /etc/kubernetes/pki/etcd/peer.key \
--ca-file /etc/kubernetes/pki/etcd/ca.crt \ --cacert /etc/kubernetes/pki/etcd/ca.crt \
--endpoints https://${HOST0}:2379 cluster-health --endpoints https://${HOST0}:2379 endpoint health --cluster
... ...
cluster is healthy https://[HOST0 IP]:2379 is healthy: successfully committed proposal: took = 16.283339ms
https://[HOST1 IP]:2379 is healthy: successfully committed proposal: took = 19.44402ms
https://[HOST2 IP]:2379 is healthy: successfully committed proposal: took = 35.926451ms
``` ```
- Set `${ETCD_TAG}` to the version tag of your etcd image. For example `v3.2.24`. - Set `${ETCD_TAG}` to the version tag of your etcd image. For example `3.4.3-0`. To see the etcd image and tag that kubeadm uses execute `kubeadm config images list --kubernetes-version ${K8S_VERSION}`, where `${K8S_VERSION}` is for example `v1.17.0`
- Set `${HOST0}`to the IP address of the host you are testing. - Set `${HOST0}`to the IP address of the host you are testing.