< img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=3131724&fmt=gif" />

Deploy etcd on KubeSphere

Written in Go, etcd is a distributed key-value store to store data that needs to be accessed by a distributed system or cluster of machines. In Kubernetes, it is the backend for service discovery and stores cluster states and configurations.

This tutorial walks you through an example of deploying etcd from the App Store of KubeSphere.

Prerequisites

  • Please make sure you enable the OpenPitrix system.
  • You need to create a workspace, a project, and a user account (project-regular) for this tutorial. The account needs to be a platform regular user and to be invited as the project operator with the operator role. In this tutorial, you log in as project-regular and work in the project demo-project in the workspace demo-workspace. For more information, see Create Workspaces, Projects, Accounts and Roles.

Hands-on Lab

Step 1: Deploy etcd from the App Store

  1. On the Overview page of the project demo-project, click App Store in the top-left corner.

    project-overview

  2. Find etcd and click Deploy on the App Information page.

    etcd-app-store

    deploy-etcd

  3. Set a name and select an app version. Make sure etcd is deployed in demo-project and click Next.

    deployment-location

  4. On the App Configurations page, specify the size of the persistent volume for etcd and click Deploy.

    specify-volume

    Note

    To specify more values for etcd, use the toggle switch to see the app’s manifest in YAML format and edit its configurations.
  5. In App Templates of the Apps page, wait until etcd is up and running.

    etcd-running

Step 2: Access the etcd Service

After the app is deployed, you can use etcdctl, a command-line tool for interacting with etcd server, to access etcd on the KubeSphere console directly.

  1. Navigate to StatefulSets in Workloads, and click the service name of etcd.

    etcd-statefulset

  2. Under Pods, expand the menu to see container details, and then click the Terminal icon.

    etcd-terminal

  3. In the terminal, you can read and write data directly. For example, execute the following two commands respectively.

    etcdctl set /name kubesphere
    
    etcdctl get /name
    

    etcd-command

  4. For clients within the KubeSphere cluster, the etcd service can be accessed through <app name>.<project name>.svc.<K8s domain>:2379 (for example, etcd-bqe0g4.demo-project.svc.cluster.local:2379 in this guide).

  5. For more information, see the official documentation of etcd.


Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.