1
구성?
개발자--------명령서버( Heml설치,NKS 어플리케이션 관리)--------NKS사용
2
3
# 별도 터미널로 모니터링
watch -d kubectl get ns,deploy,rs,svc,pods --kubeconfig="/root/kubeconfig.yaml"
1
# 명령서버에 로그인
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
# 설치?
# mywebserver 라는 이름으로 설치해보자.
helm install mywebserver bitnami/nginx --kubeconfig="/root/kubeconfig.yaml"
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 확인?
k get pods -l app.kubernetes.io/name=nginx
NAME READY STATUS RESTARTS AGE
mywebserver-nginx-d57766ddd-8bzrb 1/1 Running 0 2m27s
14
상세히 확인 , URL 확인?
k 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분 소요)
15
외부 IP 로 브라우저로 접속 확인?
잘 된다.
로드 밸런서와 pod가 모두 생성됨!!
16
# 서버수 증가 , 감소 = POD수 증가 감소
k scale deployment mywebserver-nginx --replicas=20
k scale deployment mywebserver-nginx --replicas=2
0
HELM을 설치하고 , HELM으로 kube-ops-view 설치한다.
앞에서 HELM 설치했으니 이부분은 참고로 보자
# 프로그램 설치를 쉽게하는 Helm 설치
1
helm cli 툴을 설치
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
현재의 버전 확인
helm version --short
2
repo에 Stable 저장소 더함
helm repo add stable https://charts.helm.sh/stable
3
차트 리스트 확인 (선택)
helm search repo stable
4
helm completion bash >> ~/.bash_completion
. /etc/profile.d/bash_completion.sh
. ~/.bash_completion
source <(helm completion bash)
# 방법 1 - git 다운로드 설치 - 80 접속
1
git clone https://codeberg.org/hjacobs/kube-ops-view.git
cd kube-ops-view/
kubectl apply -k deploy
2
# 외부에서 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:
(3분 걸림)
# type: ClusterIP => type: LoadBalancer 로 수정.
# kube ops view 접속 URL
kubectl get svc kube-ops-view | tail -n 1 | awk '{ print "Kube-ops-view URL = http://"$4 }'
2
# 방법 2
# Helm 으로 설치 - 8080 접속
kubens kube-system
( 5분 걸림)
2
kubens kube-system
Context "i-07fd28704cd927cb4@eks-demo.ap-northeast-2.eksctl.io" modified.
Active namespace is "kube-system".
k get svc
kube-ops-view LoadBalancer 10.100.18.156 a2f43379b1fb0440db35af6dc4a29f2b-1377535766.ap-northeast-2.elb.amazonaws.com 8080:30385/TCP 2m1s
[root@ip-172-31-40-122 alb-ingress-controller]#
8080 접속
a2f43379b1fb0440db35af6dc4a29f2b-1377535766.ap-northeast-2.elb.amazonaws.com:8080
AWS 콘솔 로그인 > EC2 > Load Balancers 가서 로드 밸런서 생성확인 > DNS name 확인
웹 브라우저에서 실행.
3
그림 설명
위 3개 cloudwatch-agent
아래 9개 kube-system- core dns , kube proxy
4
참고 자료
https://codeberg.org/hjacobs/kube-ops-view
1
k get ns
kubectl get ns --kubeconfig=/root/kubeconfig.yaml
k run myweb1 --image nginx
k run myweb2 --image nginx
k run myweb3 --image nginx
k delete pod myweb1
k delete pod myweb2
k delete pod myweb3
2
컨테이너가 추가 된것을 확인하자~
노란색 디폴트가 3개 추가 된다.~
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
5
웹서비스 삭제
kube-ops-view 삭제
NKS와 네트워크는 테라폼으로 삭제
terraform destroy -auto-approve
6
NKS 노드 삭제
클러스터 삭제
로드 밸런서 삭제
NATGW 삭제
프라이빗 라우팅테이블에 0.0.0.0/0 NAT1 삭제
서브넷 삭제
VPC 삭제
7
# 전체 다시 보기
https://brunch.co.kr/@topasvga/4193
다음
https://brunch.co.kr/@topasvga/4208
감사합니다.