본문 바로가기

Helm Repository/GitHub

Github을 Helm Chart Repository로 활용하기

# Github를 helm chart 리포지토리로 활용하는 방법

- Helm은 쿠버네티스의 리소스를 쉽게 배포할수 있도록 만들어주는 패키지 관리 툴이다. Helm 에서 개인 리파지토리를 설정할 수가 있는데 여기서는 Github를 활용하는 방법에 대해서 알아본다.

1. Github에 저장하고자 하는 리파지토리를 생성한다.

- 여기서는 테스트로 helm-eks-repository 라는 리파지토리를 생성 하겠다.

2. 배포 폴더 생성 및 패키징 파일 생성

- cmd나 bash cli를 활용하여 아래의 명령어를 입력 후 폴더를 생성 및 접근한다. (cmd는 &&가 안먹히니 참고)

mkdir my-helm-repository && cd my-helm-repository

- 패키징 파일을 해당 폴더로 이동한다. 패키징 파일이 없다면 신규로 생성한다.

- helm을 초기화 한다.

helm repo index .

- helm을 초기화 한뒤 파일 리스트를 조회해보면 index.yaml 이라는 파일이 생성된 것을 확인 할 수 있다.

\Desktop\my-helm-repository> dir


    디렉터리: C:\Users\seungkim\Desktop\my-helm-repository


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----      2023-03-07   오후 4:58           3914 EKS_Resource-0.1.0.tgz
-a----      2023-03-08   오후 1:17            402 index.yaml

- index.yaml 파일의 내용은 아래와 같다.

apiVersion: v1
entries:
  EKS_Resource:
  - apiVersion: v2
    appVersion: 1.16.0
    created: "2023-03-08T13:17:19.603548+09:00"
    description: A Helm chart for Kubernetes
    digest: 5f027f480c948a828e2cd8bce1e1d718ecd395ee6e7da7a5dbe13a332c4d9db8
    name: EKS_Resource
    type: application
    urls:
    - EKS_Resource-0.1.0.tgz
    version: 0.1.0
generated: "2023-03-08T13:17:19.6015484+09:00"

3. github로 모두 커밋

- 신규로 생성된 폴더로 이동하여 아래의 명령어를 활용, github로 커밋 및 push를 수행한다.

$ git init
$ git remote add origin https://github.com/Nanninggu/helm-eks-repository.git
$ git status
$ git add *
$ git commit -m 'initial commit'
$ git push -u origin master

Github에 해당 Repository로 이동 후 상단 Setting 버튼을 눌러 설정 화면으로 진입 한뒤, GitHub Page 설정 부분에서 Source를 master branch로 하면 해당 repository를 Github Page를 통해 HTTP 요청을 받을 수 있는 상태가 된다.

4. helm repository 등록

- 기존의 로컬 영역으로 돌아와 아래의 명령어를 통해 helm repository를 등록한다.

helm repo add seung-repo https://Nanninggu.github.io/helm-eks-repository/

helm repo update

- helm repo list를 통해 생성한 repository를 확인한다.

PS C:\Users\seungkim\Desktop\my-helm-repository> helm repo list
NAME            URL
stable          https://charts.helm.sh/stable
seung-repo      https://Nanninggu.github.io/helm-eks-repository/

- 끝 -