Deploy nginx with helm

Page content

우선 docker로 실행한 nginx container를 종료시키고

cychong@mini1:~/work/helm-chart-github$ docker ps -a |grep nginx
a66786635c60        nginx                     "/docker-entrypoint.…"   7 minutes ago       Up 7 minutes                                       k8s_nginx_my-nginx-77596b9fc6-7txns_default_44840d63-b496-4a58-9e18-83e503c6d2cf_0
85c85322ea59        k8s.gcr.io/pause:3.1      "/pause"                 7 minutes ago       Up 7 minutes                                       k8s_POD_my-nginx-77596b9fc6-7txns_default_44840d63-b496-4a58-9e18-83e503c6d2cf_0
5be06dc3b184        nginx                     "nginx -g 'daemon of…"   2 weeks ago         Up 2 weeks                  0.0.0.0:8099->80/tcp   podcast
2812c510a5b6        nginx                     "nginx -g 'daemon of…"   2 weeks ago         Up 2 weeks                  0.0.0.0:80->80/tcp     sosa0sa
cychong@mini1:~/work/helm-chart-github$ docker stop 5be06dc3b184
5be06dc3b184

nginx를 구동시킬 helm chart 준비

cychong@mini1:~/work/helm-chart/nginx$ tree -f
.
├── ./Chart.yaml
├── ./README.md
├── ./charts
├── ./nginx-pv.yaml
├── ./templates
│   ├── ./templates/NOTES.txt
│   ├── ./templates/_helpers.tpl
│   ├── ./templates/deployment.yaml
│   ├── ./templates/ingress.yaml
│   ├── ./templates/pvc.yaml
│   ├── ./templates/service.yaml
│   └── ./templates/tests
│       └── ./templates/tests/test-connection.yaml
└── ./values.yaml

우선 PV(Persistent Volume) 생성.

cychong@mini1:~/work/helm-chart$ kubectl delete -f nginx/nginx-pv.yaml
persistentvolume "nginx-pv" deleted
cychong@mini1:~/work/helm-chart$ kubectl create -f nginx/nginx-pv.yaml
persistentvolume/nginx-pv created
cychong@mini1:~/work/helm-chart$ helm install podcast nginx
NAME: podcast
LAST DEPLOYED: Fri Jul  3 00:01:05 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services podcast-nginx)
  export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
cychong@mini1:~/work/helm-chart$ kubectl get pods
NAME                             READY   STATUS    RESTARTS   AGE
podcast-nginx-8674747f9c-5tdlf   1/1     Running   0          11s
cychong@mini1:~/work/helm-chart$ kubectl get svc
NAME            TYPE        CLUSTER-IP      EXTERNAL-IP     PORT(S)          AGE
kubernetes      ClusterIP   10.96.0.1       <none>          443/TCP          298d
podcast-nginx   NodePort    10.107.86.180   192.168.1.100   8099:30492/TCP   14s
 1361  kubectl delete -f nginx/sosa0sa-pv.yaml
 1362  kubectl create -f nginx/sosa0sa-pv.yaml
 1363  helm install -f values-sosa0sa.yaml sosa0sa nginx