Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel6
outlinefalse
typelist
printablefalse

...

필자 생각에는 참고 삼아 배포하거나 show values 등의 명령을 사용하여 리서치할 용도가 아니라, 본인의 K8s에 배포를 목적으로 한다면, 위 1번이 버전을 따로 관리하기에도 편하고 charts 구조 및 내용을 탐색하기에도 편한 듯 하다.
캐바캐이니, 편한대로 하여도 좋으나, 여기서는 1번 방식으로 배포하도록 하겠다.

Values override

influxdata/influxdb 내부의 values를 상황에 맞게 override 하자.

...

이제, 앞서 연결한 InfluxDB data source에 위 kapacitor를 연결하면 정상 작동 할 것이다.

...

Deploy ETCD

일단 모든 공개 허브에서 etcd를 검색해보면, 아래와 같이 여러 APP VERSION의 Repo가 출력된다.

...

Code Block
languagebash
$ helm search hub etcd
URL                                                     CHART VERSION   APP VERSION     DESCRIPTION
https://artifacthub.io/packages/helm/wenerme/etcd       9.0.4           3.5.9           etcd is a distributed key-value store designed ...
https://artifacthub.io/packages/helm/bitnami/etcd       9.0.4           3.5.9           etcd is a distributed key-value store designed ...
https://artifacthub.io/packages/helm/wener/etcd         9.0.4           3.5.9           etcd is a distributed key-value store designed ...
https://artifacthub.io/packages/helm/bitnami-ak...      8.5.8           3.5.5           etcd is a distributed key-value store designed ...
https://artifacthub.io/packages/helm/riftbit/etcd       6.8.4           3.5.0           etcd is a distributed key value store that prov...
https://artifacthub.io/packages/helm/cloudnativ...      2.2.3           3.3.13          etcd is a distributed key value store that prov...
https://artifacthub.io/packages/helm/gardener-c...      5.3.1           v3.5.2          Helm chart for etcd
https://artifacthub.io/packages/helm/groundhog2...      0.1.5           v3.5.9          A Helm chart for etcd on Kubernetes
https://artifacthub.io/packages/helm/kubesphere...      0.1.3           3.3.12          etcd is a distributed reliable key-value store ...
...

Kapacitor와 마찬가지로, CloudHub에서 현재까지 공식 호환 Etcd 버전은 3.3.11이지만, 최신 버전도 호환되는 지 여부 등을 테스트 해보기 위해 APP VERSION=3.5.9로 설치할텐데, 이는 이미 이전에 bitnami repo가 추가된 상태이므로 바로 repo를 다운로드할 수 있다.

Code Block
languagebash
$ helm search repo etcd
NAME            CHART VERSION   APP VERSION     DESCRIPTION
bitnami/etcd    9.0.2           3.5.9           etcd is a distributed key-value store designed ...

$ helm pull bitnami/etcd && tar xzf etcd-9.0.2.tgz

etcd helm chart를 보면 매우 복잡한 구조로 되어 있음을 볼 수 있다.
일단, ./etcd/templates/statefulset.yaml./etcd/values.yaml을 살펴보고 필요한 항목을 override한다.

필자가 추가한 내용은 다음과 같다.

Code Block
languageyaml
$ etcd_override.yaml
replicaCount: 3
persistence:
  ## @param persistence.enabled If true, use a Persistent Volume Claim. If false, use emptyDir.
  ##
  enabled: false
tolerations:
  - operator: Exists
disasterRecovery:
  cronjob:
    tolerations:
      - operator: Exists
  1. Etcd cluster 개수의 최소 요구 조건은 3개 이므로, replicaCount는 3개로 주었다.

  2. persistence는 InfluxDB와 마찬가지로 PersistentVolume 부터 따로 다룬 후 적용할 것이다.
    지금은 enabled: false.

  3. 현재 테스트 베드 구성 상, worker 노드를 2개만 생성하였다. 1번의 제약으로 인해 control plane에도 생성되게 하기 위해 tolerations를 적용하였다.
    물론 Production에서는 worker node에만 생성되게 하는 것을 권장한다.

  4. Sevice는 Etcd의 경우 CloudHub 서버에서만 접속 가능하면 되므로, 별도 외부에서 접속할 일이 없을 듯 하여 default values로 두었다.

아래와 같이 배포한 후, 정상 배포되면 접속 방법 등의 간략한 가이드가 출력될텐데, 어떤 것들이 있는지 눈여겨 봐두면 이후 작업(CloudHub 설정 작업 등)에 도움이 될 수 있을 것이다.

Code Block
languagebash
# helm install -n helm-test -g -f etcd_override.yaml ./etcd
NAME: etcd-1688819715
LAST DEPLOYED: Sat Jul  8 21:35:15 2023
NAMESPACE: helm-test
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: etcd
CHART VERSION: 9.0.2
APP VERSION: 3.5.9

** Please be patient while the chart is being deployed **

etcd can be accessed via port 2379 on the following DNS name from within your cluster:

    etcd-1688819715.helm-test.svc.cluster.local

To create a pod that you can use as a etcd client run the following command:

    kubectl run etcd-1688819715-client --restart='Never' --image docker.io/bitnami/etcd:3.5.9-debian-11-r18 --env ROOT_PASSWORD=$(kubectl get secret --namespace helm-test etcd-1688819715 -o jsonpath="{.data.etcd-root-password}" | base64 -d) --env ETCDCTL_ENDPOINTS="etcd-1688819715.helm-test.svc.cluster.local:2379" --namespace helm-test --command -- sleep infinity

Then, you can set/get a key using the commands below:

    kubectl exec --namespace helm-test -it etcd-1688819715-client -- bash
    etcdctl --user root:$ROOT_PASSWORD put /message Hello
    etcdctl --user root:$ROOT_PASSWORD get /message

To connect to your etcd server from outside the cluster execute the following commands:

    kubectl port-forward --namespace helm-test svc/etcd-1688819715 2379:2379 &
    echo "etcd URL: http://127.0.0.1:2379"

 * As rbac is enabled you should add the flag `--user root:$ETCD_ROOT_PASSWORD` to the etcdctl commands. Use the command below to export the password:

    export ETCD_ROOT_PASSWORD=$(kubectl get secret --namespace helm-test etcd-1688819715 -o jsonpath="{.data.etcd-root-password}" | base64 -d)