Giter VIP home page Giter VIP logo

kubernetes-etcd-example's Introduction

Single Node Etcd Cluster with Persistent Storage on K8s

This document describes the steps to run a single instance Etcd cluster backed by persistent volume (Google Persistent disks) on Kubernetes. We use StatefulSet primitive to run Etcd so that it is stable with persistence across Pod (re)scheduling.

Prerequisites

The steps below assume that you have a running Kubernetes cluster and kubectl is configured to connect to the cluster.

Setup

Run following command to deploy etcd with GCP persistent volume.

kubectl create -f statefulset/

Verification

Inspect etcd artifacts in Kubernetes cluster. Run following command to verify if service object has been created.

kubectl get svc/etcd-svc statefulsets/etcd po/etcd-0 pvc/etcd-data-dir-etcd-0 -o wide

You should see an output like this

NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE SELECTOR
svc/etcd-svc   ClusterIP   10.11.254.21   <none>        2379/TCP   4h app=etcd

NAME                DESIRED   CURRENT   AGE
statefulsets/etcd   1         1         4h        etcd quay.io/coreos/etcd:latest   app=etcd

NAME        READY     STATUS    RESTARTS   AGE       IP         NODE
po/etcd-0   1/1       Running   0          3h        10.8.2.7   gke-cluster-1-default-pool-835cace8-nvmn

NAME                       STATUS    VOLUME                                   CAPACITY   ACCESSMODES   STORAGECLASS   AGE
pvc/etcd-data-dir-etcd-0   Bound     pvc-8fd97ce7-7172-11e7-bf09-42010a800061 10Gi       RWO           standard       4h

Testing

In order to verify the persistance stability across rescheduling of pods,

  • create some data in Etcd using etcdctl command
  • Force rescheduling of Pod to another node. You can use 'kubectl drain ' to do that.
  • Verify that data exist after Etcd pod is rescheduled and UP on another node.

kubernetes-etcd-example's People

Contributors

droot avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.