๋กœ์ผ“๐Ÿพ
article thumbnail

์™œ Helm ์„ ์‚ฌ์šฉํ•˜๋‚˜์š”?


Helm ์ด ๋ฌด์—‡์ธ์ง€ ์•Œ์•„๋ณด๊ธฐ ์ „์— ์™œ ํ•„์š”ํ•œ์ง€ ๋จผ์ € ์•Œ์•„๋ณด์ฃ  ! ๐Ÿง

 

Consistency

์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์— ๋ฆฌ์†Œ์Šค๋ฅผ ๋ฐฐํฌํ•˜๋ ค๋ฉด ์•„๋ž˜ ์ด๋ฏธ์ง€์ฒ˜๋Ÿผ yaml ๋กœ ์ž‘์„ฑํ•ด์ฃผ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.

yaml ์ด 1,2 ๊ฐœ๋ผ๋ฉด ๊ด€๋ฆฌ๊ฐ€ ์–ด๋ ต์ง€ ์•Š๊ฒ ์ง€๋งŒ 10๊ฐœ ์ •๋„๋งŒ ๋˜๋„ ๊ด€๋ฆฌํ•˜๊ธฐ๊ฐ€ ๋งค์šฐ ํž˜๋“ค๊ณ  ๋ถˆํŽธํ•ด์ง‘๋‹ˆ๋‹ค.

 

 

 

๋˜ํ•œ kubectl edit์„ ํ†ตํ•ด ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์˜ ๋ฆฌ์†Œ์Šค๋ฅผ ์—…๋ฐ์ดํŠธ ํ•ด์ค„ ์ˆ˜ ์žˆ๋Š”๋ฐ, ์—ฌ๋Ÿฌ ๊ฐœ๋ฐœ์ž๊ฐ€ ๊ด€๋ฆฌ๋ฅผ ํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด ์ผ๊ด€์„ฑ(Consistency) ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

Revision History

์–ด๋– ํ•œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด Deploy, ConfigMap, Service, Ingress yaml ๋กœ ๋ฐฐํฌ๋œ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด๋ณด์ฃ .

์ด๋•Œ ConfigMap ๊ณผ Service ๊ฐ€ ์—…๋ฐ์ดํŠธ ๋˜์–ด์„œ yaml ์ด ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

 

 

ํ•˜์ง€๋งŒ ์—…๋ฐ์ดํŠธ ๊ฒฐ๊ณผ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ž‘๋™ํ•˜์ง€ ์•Š์•„ ์ด์ „ ๋ฒ„์ „์œผ๋กœ ๋กค๋ฐฑ์œผ๋กœ ํ•˜๊ณ  ์‹ถ์€๋ฐ, yaml ๋กœ๋งŒ ๊ตฌ์„ฑ๋˜์–ด์žˆ๋‹ค๋ฉด ๋กค๋ฐฑํ•˜๋Š” ์ž‘์—…์ด ๊ฒฐ์ฝ” ์‰ฌ์šด ์ž‘์—…์€ ์•„๋‹๊ฒ๋‹ˆ๋‹ค.

 

CNCF - Graduated

CNCF ๋Š” Cloud Native Computing Foundation ์˜ ์•ฝ์ž๋กœ, ์—ฌ๋Ÿฌ ํšŒ์‚ฌ๋“ค์ด ๋ชจ์—ฌ ์„œ๋กœ ์นœํ™”์ ์ธ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š” ๊ทธ๋ฃน์ž…๋‹ˆ๋‹ค. ๋Œ€ํ‘œ์ ์ธ ํšŒ์‚ฌ๊ฐ€ ๊ตฌ๊ธ€์ด๋ฉฐ, ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๋˜ํ•œ CNCF ํ”„๋กœ์ ํŠธ ์ค‘ ์ผ๋ถ€์ฃ .

 

Helm ๋˜ํ•œ CNCF ํ”„๋กœ์ ํŠธ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์™€ ๊ต‰์žฅํžˆ ์นœํ™”์ ์ž…๋‹ˆ๋‹ค.

 

์—ฌ๋‹ด์œผ๋กœ LogStash ๋Œ€์‹  ์š”์ฆ˜ FluentBit ์„ ๋” ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” ์ด์œ ๊ฐ€ FluentBit ์€ CNCF ํ”„๋กœ์ ํŠธ์ด๊ธฐ ๋•Œ๋ฌธ์ด์ฃ 

 

์ด์™ธ ๋” ๋งŽ์€ ์ด์œ ๊ฐ€ ์žˆ๊ฒ ์ง€๋งŒ ํฌ๊ฒŒ ์œ„ 3๊ฐ€์ง€ ์ด์œ ๋งŒ์œผ๋กœ๋„ Helm ์€ ์ถฉ๋ถ„ํžˆ ๋งค๋ ฅ์ ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

 

 

๊ทธ๋Ÿผ Helm ์ด ๋ฌด์—‡์ด์ฃ ?


Helm ์€ ๋‹ค๋ฅธ ํŒจํ‚ค์ง€ ๋งค๋‹ˆ์ €์™€ ๋‹ค๋ฅผ๊ฒŒ ์—†์Šต๋‹ˆ๋‹ค.

 

์šฐ๋ถ„ํˆฌ ํ™˜๊ฒฝ์—์„  apt ๋ฅผ ์ด์šฉํ•ด ํŒจํ‚ค์ง€๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ณ , CentOS ๋Š” yum, ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” npm ์„ ํ†ตํ•ด ํŒจํ‚ค์ง€๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ํ™˜๊ฒฝ์—์„  helm ์„ ํ†ตํ•ด ํŒจํ‚ค์ง€๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

 

 

helm ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜๊ณ , ๋กค๋ฐฑํ•˜๊ณ  ์‚ญ์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

Helm ์„ ํ†ตํ•ด ์–ป์„ ์ˆ˜ ์žˆ๋Š” ์žฅ์ ์€ ๋ญ๊ฐ€ ์žˆ์„๊นŒ์š”?


Helm ์˜ ์žฅ์ ์€ 7๊ฐ€์ง€๋กœ ๋งํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  1. Simple
  2. Revision History
  3. Dynamic Configuration
  4. Consistency
  5. Intelligent Deploy
  6. Life Cycle Hooks
  7. Security

ํ•˜๋‚˜ํ•˜๋‚˜์”ฉ ์•Œ์•„๋ณด์ฃ !

 

Simple

Helm ์ด ์—†๋‹ค๋ฉด MongDB ๋ฅผ ์„ค์น˜ํ•  ๋•Œ๋งˆ๋‹ค ๊ด€๋ จ yaml ์„ ํ•˜๋‚˜ํ•˜๋‚˜ kube-apiserver ์— ์ „๋‹ฌํ•ด์ฃผ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ Helm ์„ ์ด์šฉํ•˜์—ฌ ์ฐจํŠธ๋กœ ๊ตฌ์„ฑํ•œ๋‹ค๋ฉด ์•„์ฃผ ์‰ฝ๊ฒŒ ์„ค์น˜๊ฐ€ ๊ฐ€๋Šฅํ•˜์ฃ !

 

 

Revision History

Helm ์€ install ์ด๋‚˜ upgrade ํ•  ๋•Œ๋งˆ๋‹ค ๋ฒ„์ „์„ ๊ธฐ๋กํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฒ„์ „ ๊ด€๋ฆฌ๊ฐ€ ์šฉ์ดํ•ฉ๋‹ˆ๋‹ค.

 

 

Dynamic Configuration

Helm ์€ value ๋กœ ์‹œ์ž‘ํ•˜๋Š” yaml ์— ์žˆ๋Š” ๋งค๊ฐœ๋ณ€์ˆ˜๋“ค์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋•Œ๋ฌธ์— values-dev.yaml values-staging.yaml ๋กœ ๋‚˜๋ˆ„์–ด ๋™์ ์œผ๋กœ ๋งค๊ฐœ๋ณ€์ˆ˜ ์ „๋‹ฌ์ด ๊ฐ€๋Šฅํ•˜์ฃ !

 

 

Consistency

ํ•ญ์ƒ ํด๋Ÿฌ์Šคํ„ฐ์™€ ์ผ๊ด€์„ฑ์„ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

Intelligent Deploy

Helm ์„ ํ†ตํ•ด yaml ๋ฅผ ๋ฐฐํฌํ•  ๋•Œ ์ˆœ์„œ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ConfigMap.yaml ์„ ๋ฐฐํฌํ•˜๊ณ  deployment.yaml ๋ฅผ ๋ฐฐํฌํ•˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋ง์ด์ฃ .

 

ํ•˜์ง€๋งŒ Helm ์€ ๋˜‘๋˜‘ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ณธ์ธ์ด ์•Œ์•„์„œ ๋ฐฐํฌํ•ฉ๋‹ˆ๋‹ค.

 

 

Life Cycle Hooks

๋‹ค์–‘ํ•œ Helm ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๋ฆฌ์†Œ์Šค์˜ ๋ผ์ดํ”„ ์‚ฌ์ดํด์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

Security

Helm ์ฐจํŠธ๋Š” ์ค‘์•™ ์„œ๋ฒ„์—์„œ ๊ด€๋ฆฌ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ „์ž ์„œ๋ช… ๋ฐฉ์‹์œผ๋กœ ๋ณด์•ˆ์„ ๊ฐ•ํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

Install


brew ๋ฅผ ํ†ตํ•ด ์•„์ฃผ ์‰ฝ๊ฒŒ helm ์„ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ brew install helm

 

helm ์€ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด ๊ฐ€์žฅ ๋จผ์ € ํ™˜๊ฒฝ ๋ณ€์ˆ˜ KUBECONFIG ๋ฅผ ์ฐพ์œผ๋ ค ํ•˜๊ณ , ๋งŒ์•ฝ ์ฐพ์ง€ ๋ชปํ•œ๋‹ค๋ฉด ~/.kube/config ์—์„œ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

 

์ฆ‰, kubectl ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ˜ธ์ŠคํŠธ์—์„œ helm ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. Helm ์ด ์•Œ์•„์„œ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ํด๋Ÿฌ์Šคํ„ฐ๋ฅผ ์ฐพ์•„์ค๋‹ˆ๋‹ค!

 

๋” ๋‹ค์–‘ํ•œ ํ™˜๊ฒฝ์—์„œ ์„ค์น˜ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์—ฌ๊ธฐ๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”

 

 

Getting Started


๊ฐ„๋‹จํ•˜๊ฒŒ Chart ๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ  ์ง์ ‘ ๋งŒ๋“  Chart ๋ฅผ Helm Chart Repo ๋“ฑ๋ก ํ•œ ํ›„ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ํ™˜๊ฒฝ์— ์„ค์น˜ํ•ด๋ณด์ฃ !

Chart ์˜ ๊ตฌ์กฐ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

 

apps ๋ผ๋Š” Main Chart ๊ฐ€ ์žˆ๊ณ , ์•ˆ์— firstapp ๊ณผ secondapp ์ด๋ผ๋Š” Sub Chart ๊ฐ€ ์žˆ๋Š” ๊ตฌ์กฐ์ž…๋‹ˆ๋‹ค.

 

 

Main Chart ์™€ Sub Chart ๊ฐ€ ์กด์žฌํ•˜๋Š” ๊ฒƒ์„ Helm ์—์„  Umbrella ์ฐจํŠธ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

 

Main Chart ๋Š” apps ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

$ helm create apps

 

apps ๋ผ๋Š” Main Chart ๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

  Chart.yaml          # ์ฐจํŠธ์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ๊ฐ€์ง„ YAML ํŒŒ์ผ
  README.md           # ์˜ต์…˜: README ํŒŒ์ผ
  values.yaml         # ์ฐจํŠธ์— ๋Œ€ํ•œ ๊ธฐ๋ณธ ํ™˜๊ฒฝ์„ค์ • ๊ฐ’๋“ค
  charts/             # ์ด ์ฐจํŠธ์— ์ข…์†๋œ ์ฐจํŠธ๋“ค์„ ํฌํ•จํ•˜๋Š” ๋””๋ ‰ํ„ฐ๋ฆฌ
  templates/          # values์™€ ๊ฒฐํ•ฉ๋  ๋•Œ, ์œ ํšจํ•œ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค manifest ํŒŒ์ผ๋“ค์ด ์ƒ์„ฑ๋  ํ…œํ”Œ๋ฆฟ๋“ค์˜ ๋””๋ ‰ํ„ฐ๋ฆฌ
  templates/NOTES.txt # ์˜ต์…˜: ๊ฐ„๋‹จํ•œ ์‚ฌ์šฉ๋ฒ•์„ ํฌํ•จํ•˜๋Š” ํ…์ŠคํŠธ ํŒŒ์ผ

 

Sub Chart ๋Š” charts ๋ผ๋Š” ๋””๋ ‰ํ„ฐ๋ฆฌ ๋ฐ‘์— ์ƒ์„ฑํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

$ cd ./charts
$ helm create firstapp
$ helm create secondapp

 

firstapp ๊ณผ secondapp ์ด๋ผ๋Š” Sub Chart ๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

 

์ดํ›„ Main Chart ์— Sub Chart ๋ฅผ ์ข…์†์‹œ์ผœ์ค์‹œ๋‹ค!

Main Chart ์— ์žˆ๋Š” Chart.yaml ์„ ์ผœ์ค๋‹ˆ๋‹ค.

$ vi Chart.yaml

 

์ดํ›„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

apiVersion: v2
name: apps
description: A Helm chart for Kubernetes

type: application

version: 0.1.0

appVersion: "1.16.0"

# firstapp ๊ณผ secondapp ์„ ์ข…์†์‹œ์ผœ์ค๋‹ˆ๋‹ค
dependencies:
  - name: firstapp
    version: 0.1.0
    repository: "file://../charts/firstapp"

  - name: secondapp
    version: 0.1.0
    repository: "file://../charts/secondapp"

 

๊ทธ๋Ÿฌ๋ฉด ์ด์ œ Helm Chart ์— ๋ฌธ์ œ๊ฐ€ ์—†๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

# ./ ๋Š” apps ์œ„์น˜์ž…๋‹ˆ๋‹ค

$ helm template ./
# ์‹ค์ œ๋กœ ์–ด๋–ป๊ฒŒ Helm Chart ๊ฐ€ ๋ฐฐํฌ๋  ๊ฒƒ์ธ์ง€ ์˜ˆ์ธกํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค
# template ๊ฐ€ ๋ฌธ์ œ์—†์ด ์ถœ๋ ฅ๋˜์—ˆ๋‹ค๊ณ  ํ•ด์„œ ์‹ค์ œ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ํ™˜๊ฒฝ์—์„œ ์ž˜ ๋™์ž‘ํ•˜๋Š”์ง€ ๋ณด์žฅํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค

$ helm lint ./ 
# chart ์˜ ๋ฌธ๋ฒ•์„ ๊ฒ€์‚ฌํ•ฉ๋‹ˆ๋‹ค
# ๋ฌธ์ œ๊ฐ€ ์—†๋‹ค๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค
#==> Linting ./
#[INFO] Chart.yaml: icon is recommended

#1 chart(s) linted, 0 chart(s) failed

 

Chart ์— ๋ฌธ์ œ๊ฐ€ ์—†์–ด๋ณด์ด๋‹ˆ ํ•œ๋ฒˆ install ํ•ด๋ณผ๊นŒ์š”?

$ helm install apps ./
# helm install <์ƒ์„ฑํ•  Chart ์ด๋ฆ„> <Chart ์œ„์น˜>

 

์„ฑ๊ณต์ ์œผ๋กœ Chart ๋ฅผ ์„ค์น˜ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์•„๋ž˜์ฒ˜๋Ÿผ NOTES.txt ์˜ ๋ฌธ๊ตฌ๊ฐ€ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

NAME: apps
LAST DEPLOYED: Wed Dec 21 22:07:30 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=apps,app.kubernetes.io/instance=apps" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit <http://127.0.0.1:8080> to use your application"
  kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT

 

์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ถ”๊ฐ€์ ์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ helm ls
#NAME	 NAMESPACE	REVISION	UPDATED                             	STATUS  	CHART     	APP VERSION
#apps	 default  	1       	2022-12-21 22:07:30.146251 +0900 KST	deployed	apps-0.1.0	1.16.0

$ kubectl get pods
#NAME                                                     READY   STATUS    RESTARTS   AGE
#apps-7d9c49f99d-zx59c                                    1/1     Running   0          2m8s
#apps-firstapp-7d9bc9d5b-prdpj                            1/1     Running   0          2m8s
#apps-secondapp-76f48d5b64-p2zkn                          1/1     Running   0          2m8s

 

๊ทธ๋Ÿผ ์ด๋ฒˆ์—” ๋กœ์ปฌ์ด ์•„๋‹Œ Helm Chart Repo ๋ฅผ ํ†ตํ•ด์„œ ์„ค์น˜ํ•ด๋ณด์ฃ !

๋กœ์ปฌ์—์„œ ์„ค์น˜ํ•œ Chart ๋ฅผ ์šฐ์„  ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

$ helm uninstall apps

 

Helm Chart Repo ๋Š” GitHub, S3, Nexus ๋“ฑ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์—ฌ๊ธฐ์„  GitHub ์„ ํ†ตํ•ด์„œ ์ง„ํ–‰ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

GitHub ์—์„œ Helm Chart ์šฉ Repo ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

 

apps ๋ผ๋Š” Main Chart ๋ฅผ ํŒจํ‚ค์ง• ํ•ฉ๋‹ˆ๋‹ค.

$ helm package apps
#Successfully packaged chart and saved it to: /helm-playground/apps-0.1.0.tgz

 

๊ทธ๋Ÿฌ๋ฉด apps-0.1.0.tgz ๋ผ๋Š” ์••์ถ•ํŒŒ์ผ์ด ์ƒ์„ฑ๋˜๋Š”๋ฐ tgz ๋Š” index.yaml ์ด๋ผ๋Š” ํŒŒ์ผ์— ์˜ํ•ด ๊ด€๋ฆฌ๋ฉ๋‹ˆ๋‹ค.

์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ index.yaml ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

$ helm repo index ./

 

์ž๋™์œผ๋กœ ์ƒ์„ฑ๋œ index.yaml ์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

apiVersion: v1
entries:
  apps:
  - apiVersion: v2
    appVersion: 1.16.0
    created: "2022-12-21T22:19:30.987083+09:00"
    dependencies:
    - name: firstapp
      repository: file://../charts/firstapp
      version: 0.1.0
    - name: secondapp
      repository: file://../charts/secondapp
      version: 0.1.0
    description: A Helm chart for Kubernetes
    digest: c5fd3210cacdbd7f28eecd319aa47a939dc82b29f96b45ff052b04e06a80b565
    name: apps
    type: application
    urls:
    - apps-0.1.0.tgz
    version: 0.1.0
generated: "2022-12-21T22:19:30.985545+09:00"

 

๊ทธ๋Ÿฌ๋ฉด ์ด์ œ ์ƒ์„ฑํ•œ tgz ์™€ index.yaml ์„ Github ์— ์˜ฌ๋ ค์ค๋‹ˆ๋‹ค.

$ git add .
$ git commit -m "Fix: upload chart"
$ git push origin main

 

์„ฑ๊ณต์ ์œผ๋กœ ์˜ฌ๋ผ๊ฐ„ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

Helm Chart Repo ๋Š” index.yaml ๊ธฐ๋ฐ˜์œผ๋กœ ๋™์ž‘์„ ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. index.yaml ๋กœ ์ด๋™ํ•œ ํ›„ Raw ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.

 

๊ทธ๋Ÿผ ์œ„์™€ ๊ฐ™์ด ์ด๋™์ด ๋˜๊ณ , URL ๋ฅผ ๋ณต์‚ฌํ•ด์ค๋‹ˆ๋‹ค.

 

๋’ค์— index.yaml ๋งŒ ์ง€์›Œ์ฃผ๊ณ , repo ๋กœ ๋“ฑ๋กํ•ด์ค๋‹ˆ๋‹ค. ๊ทธ ํ›„ ๋“ฑ๋ก์ด ์ž˜๋˜์—ˆ๋Š” ์ง€ ํ™•์ธํ•ด์ค๋‹ˆ๋‹ค.

$ helm search repo helm-chart-repo
#NAME                	CHART VERSION	APP VERSION	DESCRIPTION
#helm-chart-repo/apps	0.1.0        	1.16.0     	A Helm chart for Kubernetes

$ helm repo add helm-chart-repo <https://raw.githubusercontent.com/kingbj940429/helm-chart-repo/main>

$ helm repo ls
#NAME           	URL
#helm-chart-repo	<https://raw.githubusercontent.com/kingbj940429/helm-chart-repo/main>

 

์„ฑ๊ณต์ ์œผ๋กœ ์ž˜ ๋“ฑ๋ก๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด ์„ค์น˜ํ•ด๋ณด์ฃ !

$ helm install apps helm-chart-repo/apps
# helm install <์„ค์น˜ํ•  chart name> <helm repo name>/<chart name>

 

apps ๋Š” helm ls ํ–ˆ์„ ๋•Œ ํ‘œ์‹œ๋  ์ด๋ฆ„์ด๊ณ , helm repo name ์€ helm repo add helm-chart-repo ์™€ ์ผ์น˜ํ•˜๊ณ , chart name ์€ helm repo ์— ์กด์žฌํ•˜๋Š” chart ์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

 

์‹ค์ œ๋กœ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์— ๋ฐฐํฌ๋˜์—ˆ๋Š” ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

$ kubectl get pods 
#NAME                              READY   STATUS    RESTARTS   AGE
#apps-696bf7b659-dbkfg             1/1     Running   0          3m10s
#apps-firstapp-68bb56df87-jtjjv    1/1     Running   0          3m10s
#apps-secondapp-687bcbccbf-thq6t   1/1     Running   0          3m10s

 

๋ชจ๋“  ๊ฒƒ์ด ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜๋Š” ๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ดํ›„ chart ์™€ repo ๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

$ helm uninstall apps
$ helm repo remove helm-chart-repo

 

๋งˆ๋ฌด๋ฆฌ


๊ฐ„๋‹จํžˆ Helm ์ด ๋ฌด์—‡์ด๊ณ , ์™œ ํ•„์š”ํ•œ์ง€๋ฅผ ์•Œ์•„๋ณด์•˜๊ณ , Helm Repo ๋ฅผ ๋งŒ๋“ค๊ณ  ๋ฐฐํฌ๊นŒ์ง€ ํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

 

์—ฌ๊ธฐ์„œ๋Š” ์•Œ์•„๋ณด์ง„ ์•Š์•˜์ง€๋งŒ Chart Template ๋ฌธ๋ฒ•, Security, Startets, Plugins ๋“ฑ ๋” ๋งŽ์€ ๊ธฐ๋Šฅ๋“ค์ด ์žˆ๋Š”๋ฐ ์ด ๋ถ€๋ถ„์€ ๋‹ค์Œ์— ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ๐Ÿ˜€

profile on loading

Loading...