Startup etcd
parent
ae6ac51ec0
commit
a6fec4c3ca
|
@ -4,12 +4,24 @@ Kubernetes components are stateless and store cluster state in [etcd](https://gi
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
The commands in this lab must be run on each controller instance: `controller-0`, `controller-1`, and `controller-2`. Login to each controller instance using the `gcloud` command. Example:
|
The commands in this lab must be run on each controller instance: `controller-0`, `controller-1`, and `controller-2`. Login to each controller instance:
|
||||||
|
|
||||||
|
```gcloud```
|
||||||
```
|
```
|
||||||
gcloud compute ssh controller-0
|
gcloud compute ssh controller-0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```az```
|
||||||
|
```
|
||||||
|
az ssh vm --name controller-0 --local-user azureuser
|
||||||
|
```
|
||||||
|
|
||||||
|
OR
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh -i $HOME/.ssh/k8sthehardway azureuser@$(az vm show -d --name controller-0 --query "publicIps" -o tsv)
|
||||||
|
```
|
||||||
|
|
||||||
### Running commands in parallel with tmux
|
### Running commands in parallel with tmux
|
||||||
|
|
||||||
[tmux](https://github.com/tmux/tmux/wiki) can be used to run commands on multiple compute instances at the same time. See the [Running commands in parallel with tmux](01-prerequisites.md#running-commands-in-parallel-with-tmux) section in the Prerequisites lab.
|
[tmux](https://github.com/tmux/tmux/wiki) can be used to run commands on multiple compute instances at the same time. See the [Running commands in parallel with tmux](01-prerequisites.md#running-commands-in-parallel-with-tmux) section in the Prerequisites lab.
|
||||||
|
@ -28,29 +40,33 @@ wget -q --show-progress --https-only --timestamping \
|
||||||
Extract and install the `etcd` server and the `etcdctl` command line utility:
|
Extract and install the `etcd` server and the `etcdctl` command line utility:
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
|
||||||
tar -xvf etcd-v3.4.15-linux-amd64.tar.gz
|
tar -xvf etcd-v3.4.15-linux-amd64.tar.gz
|
||||||
sudo mv etcd-v3.4.15-linux-amd64/etcd* /usr/local/bin/
|
sudo mv etcd-v3.4.15-linux-amd64/etcd* /usr/local/bin/
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure the etcd Server
|
### Configure the etcd Server
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
|
||||||
sudo mkdir -p /etc/etcd /var/lib/etcd
|
sudo mkdir -p /etc/etcd /var/lib/etcd
|
||||||
sudo chmod 700 /var/lib/etcd
|
sudo chmod 700 /var/lib/etcd
|
||||||
sudo cp ca.pem kubernetes-key.pem kubernetes.pem /etc/etcd/
|
sudo cp ca.pem kubernetes-key.pem kubernetes.pem /etc/etcd/
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The instance internal IP address will be used to serve client requests and communicate with etcd cluster peers. Retrieve the internal IP address for the current compute instance:
|
The instance internal IP address will be used to serve client requests and communicate with etcd cluster peers. Retrieve the internal IP address for the current compute instance:
|
||||||
|
|
||||||
|
```gcloud```
|
||||||
```
|
```
|
||||||
INTERNAL_IP=$(curl -s -H "Metadata-Flavor: Google" \
|
INTERNAL_IP=$(curl -s -H "Metadata-Flavor: Google" \
|
||||||
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip)
|
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```az```
|
||||||
|
```
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y jq
|
||||||
|
INTERNAL_IP=$(curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | jq -r '.network.interface[0].ipv4.ipAddress[0].privateIpAddress')
|
||||||
|
```
|
||||||
|
|
||||||
Each etcd member must have a unique name within an etcd cluster. Set the etcd name to match the hostname of the current compute instance:
|
Each etcd member must have a unique name within an etcd cluster. Set the etcd name to match the hostname of the current compute instance:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -96,11 +112,9 @@ EOF
|
||||||
### Start the etcd Server
|
### Start the etcd Server
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable etcd
|
sudo systemctl enable etcd
|
||||||
sudo systemctl start etcd
|
sudo systemctl start etcd
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> Remember to run the above commands on each controller node: `controller-0`, `controller-1`, and `controller-2`.
|
> Remember to run the above commands on each controller node: `controller-0`, `controller-1`, and `controller-2`.
|
||||||
|
|
Loading…
Reference in New Issue