brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Jul 02. 2021

EKS 1탄-7. EKS CA , 삭제(종료)

실습 1탄 = 7/7

클러스터 오토스케일러(AutoScaling)  = CA  실습해보자

EC2 NODE 서버를 증가시키는 것이다. = 물리 서버를 증가시키는 것이다.


<1> Amazon EKS 클러스터 AutoScaling 설정하기

<2> 확인

<3> EKS 삭제

<4> 과정2 - EKS 2탄 

<10>   AWS EKS 실습 1



<1> Amazon EKS 클러스터 AutoScaling 설정하기


1

실습환경


4. AWS Cloud9 환경  설정

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


6. AWS에서 EKS 클러스터 만들기

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


Kops view로 결과를 확인해야 한다.

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


  

2

cloud9 접속


echo ${AWS_REGION}


리전 변경 필요시

export AWS_REGION=us-east-1

export AWS_REGION=us-east-2

export AWS_REGION=us-west-1

export AWS_REGION=us-west-2


US East (N. Virginia)us-east-1

US East (Ohio)us-east-2

US West (N. California)us-west-1

US West (Oregon)us-west-2


echo ${AWS_REGION}



3

Auto Scaling Group 설정 확인

ClusterName=$CLUSTER_NAME

RegionName=$AWS_DEFAULT_REGION


echo ${ClusterName}


aws autoscaling  describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='${ClusterName}']].[AutoScalingGroupName, MinSize, MaxSize,DesiredCapacity]" --output table



aws autoscaling  describe-auto-scaling-groups --query "AutoScalingGroups[? Tags[? (Key=='eks:cluster-name') && Value=='eks-demo']].[AutoScalingGroupName, MinSize, MaxSize,DesiredCapacity]" --output table


-------------------------------------------------------------

|                 DescribeAutoScalingGroups                 |

+-------------------------------------------+----+----+-----+

|  eks-fabd0a31-606c-4fea-80f1-b2ffd868a937 |  3 |  3 |  3  |

+-------------------------------------------+----+----+-----+



4

콘솔 > EC2 > Auto Scaling Group > details  > 편집 >  용량을 늘려준다.

Maximum capacity  3->  7



5

cloud9에서 예제 다운로드

wget https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/aws/examples/cluster-autoscaler-autodiscover.yaml



6

vi cluster-autoscaler-autodiscover.yaml

변경전

 - --node-group-auto-discovery=asg:tag=k8s.io/cluster-autoscaler/enabled,k8s.io/cluster-autoscaler/<YOUR CLUSTER NAME>

변경후

 - --node-group-auto-discovery=asg:tag=k8s.io/cluster-autoscaler/enabled,k8s.io/cluster-autoscaler/${ClusterName}


...          

         command:

             - ./cluster-autoscaler

             - --v=4

             - --stderrthreshold=info

             - --cloud-provider=aws

             - --skip-nodes-with-local-storage=false

             - --expander=least-waste

             - --node-group-auto-discovery=asg:tag=k8s.io/cluster-autoscaler/enabled,k8s.io/cluster-autoscaler/eks-demo

 ...

// 클러스터 이름을 eks-demo로 수정해야 한다!!!



<2> 확인


1

다른 터미널에서 모니터링

watch -d 'kubectl get pods,rs,deploy -o wide'


2

k-ops-view로 확인

EC2 > LB > Classic LB DNS로 웹 접속



변경전




4

kubectl apply -f cluster-autoscaler-autodiscover.yaml


5

kubectl get nodes -w

NAME                             STATUS   ROLES    AGE   VERSION

ip-192-168-4-245.ec2.internal    Ready    <none>   13d   v1.19.6-eks-49a6c0

ip-192-168-49-221.ec2.internal   Ready    <none>   13d   v1.19.6-eks-49a6c0

ip-192-168-60-100.ec2.internal   Ready    <none>   13d   v1.19.6-eks-49a6c0


kubectl get rs -w

NAME                            DESIRED   CURRENT   READY   AGE

demo-flask-backend-669cb864d8   1         1         0       12d

demo-flask-backend-7d5fdf8bcb   1         1         0       12d

kube-ops-view-894bc75fb         1         1         1       12d


kubectl get deploy -w

NAME                 READY   UP-TO-DATE   AVAILABLE   AGE

demo-flask-backend   0/1     1            0           12d

kube-ops-view        1/1     1            1           12d



6

kubectl create deployment autoscaler-demo --image=nginx

kubectl scale deployment autoscaler-demo --replicas=100

kubectl get deployment autoscaler-demo --watch


$ kubectl create deployment autoscaler-demo --image=nginx

deployment.apps/autoscaler-demo created


$ kubectl scale deployment autoscaler-demo --replicas=100

deployment.apps/autoscaler-demo scaled


kubectl get deployment autoscaler-demo --watch

NAME              READY    UP-TO-DATE   AVAILABLE   AGE

autoscaler-demo   65/100   100          65          90s



7

워커노드 scale- out 확인


k-ops-view로 확인


변경전


변경후



8

디플로이먼트 지우기

kubectl delete deployment autoscaler-demo


워커노드 scale- in 확인




<3>  EKS 삭제


1

EC2 > Autoscaling group  > 삭제


2

EC2>  삭제 되었는지 확인




3

로드밸러서 LB도 삭제



4

Cloud9 삭제




<4> 과정2 - EKS 2탄 


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




<10>   (EKS 실습 1탄)  애플리케이션


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



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



감사합니다.








매거진의 이전글 EKS 1탄-6. EKS Pod AutoScaling

작품 선택

키워드 선택 0 / 3 0

댓글여부

afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari