2.6.2 创建Service

接下来在每个Master节点创建Etcd Service并启动:

     # vim /usr/lib/systemd/system/etcd.service
     [Unit]
     Description=Etcd Service
     Documentation=https://coreos.com/etcd/docs/latest/
     After=network.target
     
     [Service]
     Type=notify
     ExecStart=/usr/local/bin/etcd --config-file=/etc/etcd/etcd.config.yml
     Restart=on-failure
     RestartSec=10
     LimitNOFILE=65536
     
     [Install]
     WantedBy=multi-user.target
     Alias=etcd3.service

所有Master节点创建Etcd的证书目录:

     # mkdir /etc/kubernetes/pki/etcd
     # ln -s /etc/etcd/ssl/* /etc/kubernetes/pki/etcd/
     # systemctl daemon-reload
     # systemctl enable --now etcd

查看Etcd集群状态:

Etcd集群状态如图2.3所示。

图2.3 Etcd集群状态