brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Jul 10. 2021

EKS 3탄-3. EKS- Helm으로 nginx설치

실습 3탄 =  3/3

<1> Helm으로 nginx 설치

<2> 4탄 전체 과정




<1> Helm으로 nginx 설치


Helm은 리눅스의 yum과 같은 패키지 관리 툴이다.

Helm으로 nginx 설치해 보자


1

alias k=kubectl

complete -F __start_kubectl k


k get ns,no,po,svc,deploy,rs,ing

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress

NAME                        STATUS   AGE

namespace/default           Active   3h22m

namespace/kube-node-lease   Active   3h22m

namespace/kube-public       Active   3h22m

namespace/kube-system       Active   3h22m


NAME                                                STATUS   ROLES    AGE     VERSION

node/ip-192-168-10-105.us-east-2.compute.internal   Ready    <none>   3h11m   v1.19.6-eks-49

node/ip-192-168-62-103.us-east-2.compute.internal   Ready    <none>   3h11m   v1.19.6-eks-49

node/ip-192-168-75-78.us-east-2.compute.internal    Ready    <none>   3h11m   v1.19.6-eks-49


NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE

service/kubernetes   ClusterIP   10.100.0.1   <none>        443/TCP   3h22m



2

curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash


helm version --short


helm repo add stable https://charts.helm.sh/stable


helm search repo stable

NAME                                    CHART VERSION   APP VERSION        DESCRIPTION                                    

stable/acs-engine-autoscaler  2.2.2  2.1.1 DEPRECATED Scales worker nodes within agent pools

stable/aerospike      0.3.5        v4.5.0.5     DEPRECATED A Helm chart for Aerospike in Kubern...


helm completion bash >> ~/.bash_completion

. /etc/profile.d/bash_completion.sh

. ~/.bash_completion

source <(helm completion bash)



Helm 로컬 목록을 최신 상태로 유지


# Helm 로컬 목록 update

helm repo add stable https://charts.helm.sh/stable


helm repo update

Hang tight while we grab the latest from your chart repositories...

...Successfully got an update from the "stable" chart repository

Update Complete. ⎈Happy Helming!⎈



3

모든 차트 사용

helm search repo



4

helm 차트에서 nginx 찾기


helm search repo nginx

NAME                            CHART VERSION   APP VERSION     DESCRIPTION                                       

stable/nginx-ingress      1.41.3      v0.34.1         DEPRECATED! An nginx Ingress controller that us...

stable/nginx-ldapauth-proxy   0.1.6    1.13.5   DEPRECATED - nginx proxy with ldapauth            

stable/nginx-lego                      0.3.1                     Chart for nginx-ingress-controller and kube-lego  

stable/gcloud-endpoints        0.1.2       1     DEPRECATED Develop, deploy, protect and monitor..



5

로컬 목록에 bitnami 추가

helm repo add bitnami https://charts.bitnami.com/bitnami



6

helm search repo nginx

NAME                                    CHART VERSION   APP VERSION     DESCRIPTION                                       

bitnami/nginx                           9.3.6           1.21.1          Chart for the nginx server                        

bitnami/nginx-ingress-controller    7.6.14     0.47.0    Chart for the nginx Ingress controller            

stable/nginx-ingress    1.41.3      v0.34.1         DEPRECATED! An nginx Ingress controller that us...

stable/nginx-ldapauth-proxy    0.1.6    1.13.5      DEPRECATED - nginx proxy with ldapauth            

stable/nginx-lego              0.3.1                          Chart for nginx-ingress-controller and kube-lego  

bitnami/kong                  3.7.8           2.4.1           Kong is a scalable, open source API layer (aka ...

stable/gcloud-endpoints    0.1.2    1     DEPRECATED Develop, deploy, protect and monitor...



7

helm search repo bitnami/nginx

NAME                                    CHART VERSION   APP VERSION     DESCRIPTION                           

bitnami/nginx                           9.3.6           1.21.1          Chart for the nginx server            

bitnami/nginx-ingress-controller    7.6.14        0.47.0          Chart for the nginx Ingress controller



8

bitnami/nginx  차트 배포?

helm install mywebserver bitnami/nginx

NAME: mywebserver

LAST DEPLOYED: Sat Jul 10 11:12:29 2021

NAMESPACE: default

STATUS: deployed

REVISION: 1

TEST SUITE: None

NOTES:

** Please be patient while the chart is being deployed **

NGINX can be accessed through the following DNS name from within your cluster:

    mywebserver-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 mywebserver-nginx'

    export SERVICE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].port}" services mywebserver-nginx)

    export SERVICE_IP=$(kubectl get svc --namespace default mywebserver-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

    echo "http://${SERVICE_IP}:${SERVICE_PORT}"



9

서비스, 파트, 디플로이먼트 배포 확인?


kubectl get svc,po,deploy

NAME          TYPE           CLUSTER-IP       EXTERNAL-IP                                      PORT(S)        AGE

service/kubernetes     ClusterIP   10.100.0.1   <none>                                  443/TCP        3h51m

service/mywebserver-nginx   LoadBalancer   10.100.161.126

a6ae0cc3-1697826770.us-east-2.elb.amazonaws.com   80:32716/TCP   70s


NAME                                     READY   STATUS    RESTARTS   AGE

pod/mywebserver-nginx-649d987559-n4crw   1/1     Running   0          70s


NAME                                READY   UP-TO-DATE   AVAILABLE   AGE

deployment.apps/mywebserver-nginx   1/1     1            1           70s



10

상세 보기?

kubectl describe deployment mywebserver



11

pod 성공 배포 확인?

kubectl get pods -l app.kubernetes.io/name=nginx

NAME                                 READY   STATUS    RESTARTS   AGE

mywebserver-nginx-649d987559-n4crw   1/1     Running   0          3m24s



12

elb 통해 웹서버 연결을 위해 상세 정보 확인

kubectl get service mywebserver-nginx -o wide

NAME          TYPE           CLUSTER-IP       EXTERNAL-IP                         PORT(S)        AGE     SELECTOR

mywebserver-nginx   LoadBalancer   10.100.161.126   c3-1697826770.us-east-2.elb.amazonaws.com   80:32716/TCP   3m46s   app.kubernetes.io/instance=mywebserver,app.kubernetes.io/name=nginx



13

확인?

웹브라우저로  elb 인 EXTERNAL-IP로   접속




14

삭제?

helm list

NAME      NAMESPACE       REVISION        UPDATED          STATUS          CHART           APP VERSION

mywebserver   default   1   2021-07-10 11:12:29.411+0 UTC deployed    nginx-9.3.6     1.21.1     


helm uninstall mywebserver



확인?

kubectl get pods -l app.kubernetes.io/name=nginx

No resources found in default namespace.



15

LB 확인?

kubectl get service mywebserver-nginx -o wide

NAME      TYPE           CLUSTER-IP       EXTERNAL-IP              PORT(S)        AGE    SELECTOR

mywebserver-nginx   LoadBalancer   10.100.161.126  e0cc3-1697826770.us-east-2.elb.amazonaws.com   80:32716/TCP   7m8s   app.kubernetes.io/instance=mywebserver,app.kubernetes.io/name=nginx



16

확인 ?

 k get ns,no,po,svc,deploy,rs,ing

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress

NAME                        STATUS   AGE

namespace/default           Active   3h59m

namespace/kube-node-lease   Active   3h59m

namespace/kube-public       Active   3h59m

namespace/kube-system       Active   3h59m


NAME                                                STATUS   ROLES    AGE     VERSION

node/ip-192-168-10-105.us-east-2.compute.internal   Ready    <none>   3h48m   v1.19.6-eks-4

node/ip-192-168-62-103.us-east-2.compute.internal   Ready    <none>   3h48m   v1.19.6-eks-4

node/ip-192-168-75-78.us-east-2.compute.internal    Ready    <none>   3h48m   v1.19.6-eks-4


NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE

service/kubernetes   ClusterIP   10.100.0.1   <none>        443/TCP   3h59m




다음은 4탄 시작

https://brunch.co.kr/@topasvga/1814



<2> 3탄 처음부터 보기


https://brunch.co.kr/@topasvga/1881



https://brunch.co.kr/@topasvga/1679



감사합니다.



매거진의 이전글 EKS 3탄-2. KUBERNETES 대시보드
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari