엔지니어 블로그

[K8S] Elasticsearch를 Helm Chart + Kustomize로 배포 본문

KUBERNETES

[K8S] Elasticsearch를 Helm Chart + Kustomize로 배포

안기용 2024. 1. 22. 11:01
  • Helm과 k8s(또는 k3s)가 설치 된 이후에 아래 내용 수행 가능

1. Helm Chart 만으로 배포

  • helm chart 만 사용하여 Elasticsearch를 배포하는 방법
  1. helm chart repo add (예시는 bitnami의 chart를 사용합니다.)

    #repo 추가
    $ helm repo add bitnami https://charts.bitnami.com/bitnami
    "bitnami" has been added to your repositories
    
    #repo list 조회
    $ helm search repo bitnami
    NAME                                            CHART VERSION   APP VERSION     DESCRIPTION
    bitnami/airflow                                 16.2.1          2.8.0           Apache Airflow is a tool to express and execute...
    bitnami/apache                                  10.3.1          2.4.58          Apache HTTP Server is an open-source HTTP serve...
    bitnami/apisix                                  2.4.3           3.7.0           Apache APISIX is high-performance, real-time AP...
    bitnami/appsmith                                2.2.1           1.9.60          Appsmith is an open source platform for buildin...
    bitnami/argo-cd                                 5.4.4           2.9.4           Argo CD is a continuous delivery tool for Kuber...
    bitnami/argo-workflows                          6.2.1           3.5.1           Argo Workflows is meant to orchestrate Kubernet...
    bitnami/aspnet-core                             5.2.1           8.0.1           ASP.NET Core is an open-source framework for we...
    ...
  2. 실행 yaml 생성

    $ helm template es bitnami/elasticsearch > es.yaml
  3. kubectl apply 로 배포

    $ kubectl apply -f es.yaml -n elastic

1)설정 내용을 변경하여 배포

  1. 변경 내용 yaml 작성

    #values.yaml
    master:
      masterOnly: false
      replicaCount: 3
  2. 변경 내용을 사용하여 새로운 실행 yaml 생성

    $ helm template es bitnami/elasticsearch -f values.yaml > es_edit.yaml
  3. 새로운 yaml로 배포

    $ kubectl apply -f es_edit.yaml -n elastic

2. Kustomize + Helm Chart 배포

  • kustomize와 helm을 같이 사용하여 Elasticsearch를 배포하는 방법
  1. kustomization.yaml 작성

    helmCharts:
      - name: elastic
        repo: https://charts.bitnami.com/bitnami
        version: 19.13.14
        releaseName: es
        namespace: elastic
        valuesFile: values.yaml
  2. 변경 내용 yaml 작성

    #values.yaml
    master:
      masterOnly: false
      replicaCount: 3
  3. 변경 내용을 적용한 배포용 yaml 생성

    $ kustomize build . --enable-helm > temp.yaml
  4. 배포

    $ kubectl apply -f temp.yaml -n elastic

3. 다수의 Helm Chart 동시 배포

  • 여러개의 helm chart를 동시에 배포하는 방법
  1. kustomization.yaml 작성

    #/helm/elasticsearch/kustomization.yaml
    helmCharts:
      - name: elastic
        repo: https://charts.bitnami.com/bitnami
        version: 19.13.14
        releaseName: es
        namespace: elastic
        valuesFile: values.yaml
    
    #/helm/postgresql/kustomization.yaml
    helmCharts:
      - name: postgre
        repo: https://charts.bitnami.com/bitnami
        version: 13.2.25
        releaseName: postgre
        namespace: elastic
        valuesFile: values.yaml
    #/helm/kustomization.yaml
    bases:
      - es
      - postgre
    
  2. 배포용 yaml 생성

    #/helm
    $ kustomize build . --enable-helm > temp.yaml
  3. 배포

    $ kubectl apply -f temp.yaml -n elastic

'KUBERNETES' 카테고리의 다른 글

[K8S] pv,pvc 삭제 안됨  (0) 2024.02.05