zshrc 플러그인에 추가하면 명령어 옵션 보기 편함.❯ brew install helm
❯ helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories
# 확인
❯ helm search repo bitnami
❯ helm search repo bitnami | grep nginx
bitnami/nginx 10.2.1 1.21.6 NGINX Open Source is a web server that can be a...
bitnami/nginx-ingress-controller 9.1.27 1.2.0 NGINX Ingress Controller is an Ingress controll...
bitnami/nginx-intel 1.0.5 0.4.7 NGINX Open Source for Intel is a lightweight se...
nginx를 바로 배포해본다.
❯ helm install helm-nginx bitnami/nginx
NAME: helm-nginx
LAST DEPLOYED: Mon May 9 22:49:20 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: nginx
CHART VERSION: 10.2.1
APP VERSION: 1.21.6
** Please be patient while the chart is being deployed **
NGINX can be accessed through the following DNS name from within your cluster:
helm-nginx.default.svc.cluster.local (port 80)
To access NGINX from outside the cluster, follow the steps below:
1. Get the NGINX URL by running these commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace default -w helm-nginx'
export SERVICE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].port}" services helm-nginx)
export SERVICE_IP=$(kubectl get svc --namespace default helm-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "http://${SERVICE_IP}:${SERVICE_PORT}"
❯ helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
helm-nginx default 1 2022-05-09 22:49:20.559748444 +0900 KST deployed nginx-10.2.1 1.21.6
# docker desktop의 경우 external IP = localhost
# localhost 로 접속하면 nginx 화면이 보임.
기본 설정을 알아봤다.
https://github.com/bitnami/charts/tree/master/bitnami/nginx
README.md에 server block 예시도 있어서 갖다쓰기 좋음.
❯ helm show all bitnami/nginx > default.yaml
# 비교 결과 git Repo의 values.yaml과 차이가 없음.
# ---
# serverBlock에 패스를 넣어봄.
❯ cat values.yaml
421 │ ## @param serverBlock Custom server block to be added to NGINX configuration
422 │ ## ...
437 │ serverBlock: |-
438 │ server {
439 │ listen 0.0.0.0:8080;
440 │ location /hello {
441 │ return 200 "hello!";
442 │ }
443 │ }
# 업그레이드 - revision 2 로 지정됐고 파드도 새로 떴음.
❯ helm upgrade -f values.yaml helm-nginx bitnami/nginx
Release "helm-nginx" has been upgraded. Happy Helming!
NAME: helm-nginx
LAST DEPLOYED: Mon May 9 23:38:12 2022
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
CHART NAME: nginx
CHART VERSION: 10.2.1
APP VERSION: 1.21.6
# ...
반영 확인.
참고로 serverBlock 정보는 configMap으로 반영되는 형식이다.
(같은 ns에서 configMap 조회해보면 관련된게 하나 보임)
❯ curl localhost/hello
hello!
웹서버인 nginx에 정적 웹사이트를 붙여주는 역할이다.
예를 들어 hugo 블로그는 빌드하면 public 디렉토리에 저장되는데
그 안에 생성되는 내용을 새 repo로 따고 그걸 가져오는 역할이다.
예시는 여기 > https://github.com/solidcellaMoon/temp-static-site
## Get the server static content from a git repository
## NOTE: This will override staticSiteConfigmap and staticSitePVC
##
cloneStaticSiteFromGit:
## @param cloneStaticSiteFromGit.enabled Get the server static content from a Git repository
##
enabled: false
## Bitnami Git image version
## ref: https://hub.docker.com/r/bitnami/git/tags/
## @param cloneStaticSiteFromGit.image.registry Git image registry
## @param cloneStaticSiteFromGit.image.repository Git image repository
## @param cloneStaticSiteFromGit.image.tag Git image tag (immutable tags are recommended)
## @param cloneStaticSiteFromGit.image.pullPolicy Git image pull policy
## @param cloneStaticSiteFromGit.image.pullSecrets Specify docker-registry secret names as an array
## ...
좀 더 찾아봤는데 nginx 단일로 제공하는건 bitnami/nginx 말고 자주 쓰이는건 없는 듯 하고, nginx-ingress 같은건 많은데 이건 ingress controller라 용도가 다른다.
외부 환경에 있는 서비스로 프록시 해주는 역할로 쓰려는건데, 그런 용도를 설정하려면 저 serverBlock 을 수정해야 하고... 결국 단일 파일 하나로 관리하는 듯 하다.
쓸 수는 있지만 최선의 선택인 것 같지 않다.
cloneFromGit은 그냥 정적 페이지 컨텐츠를 가져와주는 역할 뿐이다.