Flux로 설치하기
Flux로 설치하기 (Installing with Flux)
Flux는 Kubernetes 클러스터에 설치할 수 있는 GitOps 도구예요. 이 페이지는 Flux를 사용해 Longhorn을 설치하는 방법을 다뤄요.
출처: 문서
본문
선행 조건 (Prerequisites)
-
워크스테이션: Helm v3.0 이상을 설치해요.
-
Kubernetes 클러스터:
- 각 노드가 설치 요구 사항을 충족하는지 확인해요.
-
Flux CLI와 컨트롤러를 설치해요.
-
Flux CLI로 Flux를 GitHub에 부트스트랩해요. 다음 명령을 실행해 GitHub 개인 액세스 토큰(PAT)을 환경 변수로 내보내고, 클러스터에 Flux 컨트롤러를 배치하고, 지정한 GitHub 저장소에서 클러스터 상태를 동기화하도록 컨트롤러를 구성해요.
export GITHUB_TOKEN=<your-github-token>
flux bootstrap github \
--token-auth \
--owner=<your-org> \
--repository=<your-repo> \
--branch=<your-branch> \
--path=<your-path> \
--personal
Longhorn Command Line Tool을 사용해 Longhorn 환경에서 잠재적인 문제를 점검하세요.
Longhorn 설치하기 (Installing Longhorn)
- Longhorn Helm 차트 URL을 가리키는 HelmRepository 커스텀 리소스(CR)를 생성해요.
kubectl create ns longhorn-system
flux create source helm longhorn-repo \
--url=https://charts.longhorn.io \
--namespace=longhorn-system \
--export > helmrepo.yaml
kubectl apply -f helmrepo.yaml
- HelmRepository를 참조하고 설치할 Longhorn Helm 차트 버전을 지정하는 HelmRelease CR을 생성해요.
flux create helmrelease longhorn-release \
--chart=longhorn \
--source=HelmRepository/longhorn-repo \
--chart-version=v1.14.0 \
--namespace=longhorn-system \
--export > helmrelease.yaml
kubectl apply -f helmrelease.yaml
- HelmRelease CR이 생성되고 성공적으로 동기화됐는지 확인해요.
flux get helmrelease longhorn-release -n longhorn-system
- Longhorn이 성공적으로 설치됐는지 확인해요.
kubectl -n longhorn-system get pod
Longhorn 설치가 성공한 예시:
NAME READY STATUS RESTARTS AGE
longhorn-ui-b7c844b49-w25g5 1/1 Running 0 2m41s
longhorn-manager-pzgsp 1/1 Running 0 2m41s
longhorn-driver-deployer-6bd59c9f76-lqczw 1/1 Running 0 2m41s
longhorn-csi-plugin-mbwqz 2/2 Running 0 100s
csi-snapshotter-588457fcdf-22bqp 1/1 Running 0 100s
csi-snapshotter-588457fcdf-2wd6g 1/1 Running 0 100s
csi-provisioner-869bdc4b79-mzrwf 1/1 Running 0 101s
csi-provisioner-869bdc4b79-klgfm 1/1 Running 0 101s
csi-resizer-6d8cf5f99f-fd2ck 1/1 Running 0 101s
csi-provisioner-869bdc4b79-j46rx 1/1 Running 0 101s
csi-snapshotter-588457fcdf-bvjdt 1/1 Running 0 100s
csi-resizer-6d8cf5f99f-68cw7 1/1 Running 0 101s
csi-attacher-7bf4b7f996-df8v6 1/1 Running 0 101s
csi-attacher-7bf4b7f996-g9cwc 1/1 Running 0 101s
csi-attacher-7bf4b7f996-8l9sw 1/1 Running 0 101s
csi-resizer-6d8cf5f99f-smdjw 1/1 Running 0 101s
instance-manager-b34d5db1fe1e2d52bcfb308be3166cfc 1/1 Running 0 114s
engine-image-ei-df38d2e5-cv6nc 1/1 Running 0 114s
-
기본 인증을 갖춘 NGINX Ingress 컨트롤러를 생성해 Longhorn UI에 접근해요. Longhorn UI에 대한 인증은 기본적으로 활성화되어 있지 않아요.
-
Longhorn UI에 접근해요.
GitOps를 통한 지속 운영 (Continuous Operations via GitOps)
내보낸 매니페스트를 커밋해 GitOps 저장소에 푸시할 수 있어요.
```bash
git add helmrepo.yaml helmrelease.yaml
git commit -m "Add HelmRepository and HelmRelease for Longhorn installation"
git push origin
그 이후에는 GitOps 저장소의 YAML 매니페스트를 편집해 HelmRelease와 HelmRepository CR을 수정할 수 있어요. Flux가 변경을 자동으로 감지해 적용하고, Kubernetes 클러스터에 직접 접근할 필요가 없어요.
## 더 알아보기 (Learn more)
- Flux CLI 설치와 부트스트랩: [Flux Installation](https://fluxcd.io/flux/installation/)
- HelmRepository CRD 레퍼런스: [HelmRepository Source API](https://fluxcd.io/flux/components/source/helmrepositories/)
- HelmRelease CRD 레퍼런스: [HelmRelease API](https://fluxcd.io/flux/components/helm/helmreleases/)
- 기본 인증을 사용한 Ingress 생성 (nginx): [Create an Ingress with Basic Authentication (nginx)](https://longhorn.io/docs/1.14.0/deploy/accessing-the-ui/longhorn-ingress/)
- 설치 요구 사항: [Installation Requirements](https://longhorn.io/docs/1.14.0/deploy/install/#installation-requirements)