Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Bootstrapping an etcd Cluster for Kubernetes

Kubernetes uses etcd to reliably store data in a distributed fashion. One of the necessary steps for setting up a Kubernetes cluster from scratch is to configure an etcd cluster that spans all of the Kubernetes control nodes. In this activity, you will learn how to install and configure an etcd cluster in preparation for setting up Kubernetes. After completing this exercise, you should be able to stand up a multi-node etcd cluster that is capable of supporting the Kubernetes control plane.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Jun 24, 2025
Duration
1h 30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Install the etcd binary on both control nodes.

    Do the following on both Kubernetes control nodes:

    wget -q --show-progress --https-only --timestamping 
      "https://github.com/coreos/etcd/releases/download/v3.3.5/etcd-v3.3.5-linux-amd64.tar.gz"
    tar -xvf etcd-v3.3.5-linux-amd64.tar.gz
    sudo mv etcd-v3.3.5-linux-amd64/etcd* /usr/local/bin/
    
  2. Challenge

    Configure and start the etcd service on both control nodes.

    Do the following on both Kubernetes control nodes:

    sudo mkdir -p /etc/etcd /var/lib/etcd
    sudo cp ca.pem kubernetes-key.pem kubernetes.pem /etc/etcd/
    

    Set the ETCD_NAME variable. Be sure to replace the placeholder in this command with controller-0 or controller-1, as appropriate for each server.

    ETCD_NAME=<controller-0 or controller-1>
    INTERNAL_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)
    CONTROLLER_0_INTERNAL_IP=<controller 0 private ip>
    CONTROLLER_1_INTERNAL_IP=<controller 1 private ip>
    

    Create the etcd systemd unit file with the following command. Be sure to replace the placeholders in --name and --initial-cluster with real values.

    cat << EOF | sudo tee /etc/systemd/system/etcd.service
    [Unit]
    Description=etcd
    Documentation=https://github.com/coreos
    
    [Service]
    ExecStart=/usr/local/bin/etcd \
      --name ${ETCD_NAME} \
      --cert-file=/etc/etcd/kubernetes.pem \
      --key-file=/etc/etcd/kubernetes-key.pem \
      --peer-cert-file=/etc/etcd/kubernetes.pem \
      --peer-key-file=/etc/etcd/kubernetes-key.pem \
      --trusted-ca-file=/etc/etcd/ca.pem \
      --peer-trusted-ca-file=/etc/etcd/ca.pem \
      --peer-client-cert-auth \
      --client-cert-auth \
      --initial-advertise-peer-urls https://${INTERNAL_IP}:2380 \
      --listen-peer-urls https://${INTERNAL_IP}:2380 \
      --listen-client-urls https://${INTERNAL_IP}:2379,https://127.0.0.1:2379 \
      --advertise-client-urls https://${INTERNAL_IP}:2379 \
      --initial-cluster-token etcd-cluster-0 \
      --initial-cluster controller-0=https://${CONTROLLER_0_INTERNAL_IP}:2380,controller-1=https://${CONTROLLER_1_INTERNAL_IP}:2380 \
      --initial-cluster-state new \
      --data-dir=/var/lib/etcd
    Restart=on-failure
    RestartSec=5
    
    [Install]
    WantedBy=multi-user.target
    EOF
    

    Start and enable the etcd service:

    sudo systemctl daemon-reload
    sudo systemctl enable etcd
    sudo systemctl start etcd
    
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight