실습 2탄 = 3/11
명령서버(EC2 or Cloud9) 이해
Helm 이해
Helm은 패키지 관리 툴이다.
리눅스의 yum 같은 툴이다.
구성?
개발자--------명령서버(EC2 or Cloud9, Heml설치,EKS 어플리케이션 관리)--------EKS사용
kubens default
watch -d kubectl get deploy,rs,pod,svc
1
명령서버인 EC2서버 로그인
sudo su -
curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
# 버전 확인 ?
helm version --short
2
차트 저장소 생성 ?
stable로 생성함
helm repo add stable https://charts.helm.sh/stable
"stable" has been added to your repositories
3
설치 가능한 차트 나열 ?
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...
stable/airflow 7.13.3 1.10.12 DEPRECATED - please use: https://github.com/air...
stable/ambassador 5.3.2 0.86.1 DEPRECATED A Helm chart for Datawire Ambassador
4
bash 설정 ?
helm completion bash >> ~/.bash_completion
. /etc/profile.d/bash_completion.sh
. ~/.bash_completion
source <(helm completion bash)
5
helm 업데이트 ?
# first, add the default repository, then update
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!⎈
6
모든 차트 나열?
helm search repo
7
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...
8
btnami 차트 리포지토리도 추가?
helm repo add bitnami https://charts.bitnami.com/bitnami
9
helm search repo bitnami
10
nginx 다시 검색?
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.13 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...
// 2개 모두 나옴
11
bitnami/nginx 검색?
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.13 0.47.0 Chart for the nginx Ingress controller
12
# 터미널 2에서 모니터링
kubens default
watch -d kubectl get deploy,rs,svc,pod
# 설치?
# mywebserver 라는 이름으로 설치해보자.
helm install mywebserver bitnami/nginx
NAME: mywebserver
LAST DEPLOYED: Thu Jul 8 10:40:33 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
# 추가 설치
helm install mywebserver1 bitnami/nginx
13
서비스, pod , 디플로이먼트 확인?
kubectl get svc,po,deploy
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 24h
service/mywebserver-nginx LoadBalancer 10.100.185.253
a8xxxxxx42.us-west-2.elb.amazonaws.com 80:32304/TCP 32s
NAME READY STATUS RESTARTS AGE
pod/mywebserver-nginx-dxddd-8bzrb 1/1 Running 0 31s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/mywebserver-nginx 1/1 1 1 32s
14
Pod 확인?
kubectl get pods -l app.kubernetes.io/name=nginx
NAME READY STATUS RESTARTS AGE
mywebserver-nginx-d57766ddd-8bzrb 1/1 Running 0 2m27s
15
상세히 확인 , URL 확인?
kubectl get service mywebserver-nginx -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
mywebserver-nginx LoadBalancer 10.100.185.253 a37252d730239409bbc4e08632528fc4-766156842.us-west-2.elb.amazonaws.com 80:32304/TCP 3m10s app.kubernetes.io/instance=mywebserver,app.kubernetes.io/name=nginx
(3분 소요)
16
외부 IP 로 브라우저로 접속 확인?
잘 된다.
로드 밸런서와 pod가 모두 생성됨!!
1
# 방법 2
Helm 으로 설치
kubens kube-system
외부에서 kube-ops-view를 접속하기 위해서 Service Type을 LoadBalancer 로 변경한다.
kubectl edit svc kube-ops-view
apiVersion: v1
kind: Service
metadata:
annotations:
name: kube-ops-view
spec:
....
sessionAffinity: None
type: LoadBalancer
status:
2
# 방법 2 - git 다운로드 설치
git clone https://codeberg.org/hjacobs/kube-ops-view.git
cd kube-ops-view/
kubectl apply -k deploy
3
# kube ops view 접속 URL
kubectl get svc kube-ops-view | tail -n 1 | awk '{ print "Kube-ops-view URL = http://"$4 }'
( 5분 걸림)
1
# Helm 리스트 확인?
helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mywebserver default 1 2021-07-08 10:40:33.89 +0000 UTC deployed nginx-9.3.6 1.21.1
2
# 삭제 ?
# helm uninstall (NAME)
helm uninstall mywebserver
3
# Pod 확인?
kubectl get pods -l app.kubernetes.io/name=nginx
4
서비스 리소스 확인?
kubectl get service mywebserver-nginx -o wide
서비스는 있음
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
mywebserver-nginx LoadBalancer 10.100.185.253 a37252d730239409bbc4e08632528fc4-766156842.us-west-2.elb.amazonaws.com 80:32304/TCP 8m37s app.kubernetes.io/instance=mywebserver,app.kubernetes.io/name=nginx
https://brunch.co.kr/@topasvga/1882
https://brunch.co.kr/@topasvga/1679