1. 개요
2. 설치
$ brew install kubernetes-helm Updating Homebrew... ==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz ######################################################################## 100.0% ==> Pouring portable-ruby-2.6.3.mavericks.bottle.tar.gz ==> Auto-updated Homebrew! Updated 3 taps (homebrew/core, homebrew/cask and homebrew/services). ==> New Formulae (생략) ==> Downloading https://homebrew.bintray.com/bottles/kubernetes-helm-2.15.2.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/af/af96fbedc19ad56994180843cda30829ce14c83b556531b8089b9c5783531fe2?__gda__=exp=1572964301~hmac=5ecb15b90e ######################################################################## 100.0% ==> Pouring kubernetes-helm-2.15.2.mojave.bottle.tar.gz ==> Caveats Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completions have been installed to: /usr/local/share/zsh/site-functions ==> Summary 🍺 /usr/local/Cellar/kubernetes-helm/2.15.2: 51 files, 85.1MB
3. 초기화
$ helm init --history-max 200 Creating /Users/stdio/.helm Creating /Users/stdio/.helm/repository Creating /Users/stdio/.helm/repository/cache Creating /Users/stdio/.helm/repository/local Creating /Users/stdio/.helm/plugins Creating /Users/stdio/.helm/starters Creating /Users/stdio/.helm/cache/archive Creating /Users/stdio/.helm/repository/repositories.yaml Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com Adding local repo with URL: http://127.0.0.1:8879/charts $HELM_HOME has been configured at /Users/stdio/.helm. Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster. Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy. To prevent this, run `helm init` with the --tiller-tls-verify flag. For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
4. Helm Repo 업데이트
$ helm repo update Hang tight while we grab the latest from your chart repositories... ...Skip local chart repository ...Successfully got an update from the "stable" chart repository Update Complete.
5. Tomcat 설치
참고로 아래 Tomcat의 테스트 컨텍스트는 /sample이다.
5.1. helm install
$ helm install --name stdio-tomcat-release stable/tomcat NAME: stdio-tomcat-release LAST DEPLOYED: Tue Nov 5 23:38:46 2019 NAMESPACE: default STATUS: DEPLOYED RESOURCES: ==> v1/Deployment NAME READY UP-TO-DATE AVAILABLE AGE stdio-tomcat-release 0/1 1 0 0s ==> v1/Pod(related) NAME READY STATUS RESTARTS AGE stdio-tomcat-release-544779dc99-bckgq 0/1 Init:0/1 0 0s ==> v1/Service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE stdio-tomcat-release LoadBalancer 10.96.207.134 80:32568/TCP 0s NOTES: 1. Get the application URL by running these commands: NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get svc -w stdio-tomcat-release' export SERVICE_IP=$(kubectl get svc --namespace default stdio-tomcat-release -o jsonpath='{.status.loadBalancer.ingress[0].hostname}') echo http://$SERVICE_IP:
5.2. get pod
$ kubectl get pod NAME READY STATUS RESTARTS AGE stdio-tomcat-release-544779dc99-bckgq 1/1 Running 0 5m33s
5.3. get svc
$ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE stdio-tomcat-release LoadBalancer 10.96.207.134 80:32568/TCP 5m36s
5.4. 삭제
$ helm del --purge stdio-tomcat-release release "stdio-tomcat-release" deleted
5.5. 설정 추가하여 설치
$ helm install --name stdio-tomcat-release \ --set service.type=NodePort \ stable/tomcat NAME: stdio-tomcat-release LAST DEPLOYED: Wed Nov 6 00:13:04 2019 NAMESPACE: default STATUS: DEPLOYED RESOURCES: ==> v1/Deployment NAME READY UP-TO-DATE AVAILABLE AGE stdio-tomcat-release 0/1 0 0 0s ==> v1/Pod(related) NAME READY STATUS RESTARTS AGE stdio-tomcat-release-544779dc99-rv7p6 0/1 Init:0/1 0 0s ==> v1/Service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE stdio-tomcat-release NodePort 10.97.108.111 80:30946/TCP 0s NOTES: 1. Get the application URL by running these commands: export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services stdio-tomcat-release) export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT
5.6. 확인
NodePort로 생성된 것을 알 수 있다.
$ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE stdio-tomcat-release NodePort 10.97.108.111 80:30946/TCP 48s