실제 k8s를 설치하고 사용하면, 생각보다 k8s의 리소스들을 관리하는 것이 복잡하였고 자연스레 아래 불편한 점들을 발견했다.
리소스 변경이 언제 적용되었는지 확인하기 힘들다.
리소스(Yaml) 파일이 많아 설치 과정이 번거롭다. 또한 유지 관리하기 힘들다.
환경별 리소스 파일을 분리하며 코드 중복이 생겼다.
등 아무튼 번거로움이 많이 있다.
이를 해결하기 위한 방법으로 Helm을 많이 사용하나 보다.
일단 먼저 사용 방법을 익히고, 어떻게 사용하는 것이 good practice인지 알아가 보려고 한다.
이후에 나올 Chart는 Helm 패키지를 뜻한다.
How to install
Helm은 k8s 용 소프트웨어를 검색하거나, 공유하고 사용하기 위한 K8s Package Manager이며,
Helm을 설치하는 방법은 아래 링크와 같이 다양한데,
먼저 여기서는 Linux 환경에서 설치할 것이므로, snap을 사용하여 설치하겠다.
Install Snap
자세한 내용은 위 링크를 참고하고, 아래와 같이 설치/세팅 한다.
With the EPEL repository added to your CentOS installation, simply install the snapd package:
$ sudo yum install snapd
Once installed, the systemd unit that manages the main snap communication socket needs to be enabled:
$ sudo systemctl enable --now snapd.socket
To enable classic snap support, enter the following to create a symbolic link between /var/lib/snapd/snap
and /snap
:
$ sudo ln -s /var/lib/snapd/snap /snap
Install Helm
Snapcrafters 커뮤니티는 Helm 패키지의 Snap 버전을 유지 보수한다.
$ sudo snap install helm --classic
“Helm이 준비되면, chart repository를 추가할 수 있다. 처음에 주로 사용하는 곳은 공식 Helm stable 차트들이다”
$ helm repo add stable https://charts.helm.sh/stable
라고 해서, 위 Repository add 하고, helm search repo stable
명령으로 조회해보면, 아래와 같이 죄다 DEPRECATED
라고 나온다.
$ helm search repo stable|head -n10 NAME CHART VERSION APP VERSION DESCRIPTION stable/acs-engine-autoscaler 2.2.2 2.1.1 DEPRECATED Scales worker nodes within agent pools stable/aerospike 0.3.5 v4.5.0.5 DEPRECATED A Helm chart for Aerospike in Kubern... stable/airflow 7.13.3 1.10.12 DEPRECATED - please use: https://github.com/air... stable/ambassador 5.3.2 0.86.1 DEPRECATED A Helm chart for Datawire Ambassador stable/anchore-engine 1.7.0 0.7.3 Anchore container analysis and policy evaluatio... stable/apm-server 2.1.7 7.0.0 DEPRECATED The server receives data from the El... stable/ark 4.2.2 0.10.2 DEPRECATED A Helm chart for ark stable/artifactory 7.3.2 6.1.0 DEPRECATED Universal Repository Manager support... stable/artifactory-ha 0.4.2 6.2.0 DEPRECATED Universal Repository Manager support...
해서, 원하는 application package 버전의 Chart를 찾아서 repo add 하여 사용한다.
다음 섹션에서 자세히 다루기로 한다.
Using Helm
Using Helm Repo
Find a package
이 전 섹션에서 다룬 것처럼, 기본 stable repo는 DEPRECATED 된 chart가 많아서, 최신 버전 혹은 원하는 버전을 찾기 어렵다.
원하는 application의 chart를 찾기 위해서는 여러 방법이 있는데,
여기에서는 Helm에서 공식 관리하는 Artifact Hub를 사용하여 원하는 chart를 가진 repo를 등록해보자.
Artifact Hub: https://artifacthub.io/
위 사이트에 접속하여 influxdb를 검색해보자.
아래와 같이 결과 화면이 출력 될 것이다.
원하는 버전의 repo를 아래와 같이 복사한다.
이 외에도 자사 제품의 손쉬운 배포 관리를 지원하기 위해,
대부분의 경우, 각 application provider가 직접 chart repo를 노출한다.
예, https://github.com/influxdata/helm-charts
또한, https://github.com/helm/monocular 도 많이 사용한다.
Add into the repo.
# Add repository $ helm repo add bitnami https://charts.bitnami.com/bitnami # List up repo $ helm repo list NAME URL stable https://charts.helm.sh/stable nginx-stable https://helm.nginx.com/stable bitnami https://charts.bitnami.com/bitnami # bitnami repo가 추가되었다. monocular https://helm.github.io/monocular influxdata https://helm.influxdata.com/
Search Chart
아래와 같이 localhost에 등록된 모든 repo에서 influxdb chart를 찾는다.
$ helm search repo influxdb NAME CHART VERSION APP VERSION DESCRIPTION bitnami/influxdb 1.0.0 1.8.3 InfluxDB is an open source time-series database... influxdata/influxdb 4.8.9 1.8.0 Scalable datastore for metrics, events, and rea... influxdata/influxdb-enterprise 0.1.12 1.8.0 Run InfluxDB Enterprise on Kubernetes influxdata/influxdb2 1.0.11 2.0.0-rc A Helm chart for InfluxDB v2 stable/influxdb 4.3.2 1.7.9 DEPRECATED Scalable datastore for metrics, even... bitnami/grafana 4.0.2 7.3.3 Grafana is an open source, feature rich metrics... influxdata/kapacitor 1.3.1 1.5.4 InfluxDB's native data processing engine. It ca... stable/kapacitor 1.2.2 1.5.2 DEPRECATED InfluxDB's native data processing en... influxdata/chronograf 1.1.19 1.8.8 Open-source web application written in Go and R... influxdata/telegraf 1.7.32 1.16 Telegraf is an agent written in Go for collecti... influxdata/telegraf-operator 1.1.5 v1.1.1 A Helm chart for Kubernetes to deploy telegraf-...
Install Chart
to do
0 Comments