** review : taint처리된 노드에서 작업을 할 수 있게끔 하는 것이 torlerations 필드
--- AWS EC2 도커 설치
=> EC2 생성 시 사용자 스크립트
=> EKS 마스터 노드에 접근하는 클라이언트의 역할
#!/bin/bash
cd /tmp
=> 이렇게 절대경로를 지정하지 않으면, 아래의 curl 명령어로 어디에 설치되었는지 알 수 없음
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
amazon-linux-extras install docker -y
systemctl enable --now docker
curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh
usermod -a -G docker ec2-user
=> 도커 그룹에 ec2-user를 추가시키면 도커 명령어 사용 시 sudo를 붙이지 않아도 됨
--- EKS
- aws 자격증명
$ aws configure
- aws ecr 업로드(push)
$ aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r5a6z4q5
$ docker tag web-site:v1.0 public.ecr.aws/r5a6z4q5/web-site:v1.0
$ docker push public.ecr.aws/r5a6z4q5/web-site:v1.0
- eks cli
$ aws eks --region ap-northeast-2 update-kubeconfig --name EKS-CLUSTER
$ curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin
$ source <(kubectl completion bash)
$ echo "source <(kubectl completion bash)" >> ~/.bashrc
$ kubectl version --short --client
$ kubectl get svc
-- IAM 사용자 생성




-- 역할(Role) 만들기
=> 역할(Role)은 특정 리소스가 다른 리소스를 관리할 수 있도록 부여하는 것




-- s3 생성



-- aws configure


-- 역할(Role)
=> EC2 자체에게 s3에 접근할 수 있는 역할(role)을 주면 aws configure가 필요 없음



-- ECR(Elastic Container Registry) 생성
















-- EKS의 컨트롤 플레인에서 사용할 역할(Role) 생성



-- EKS(Elastic Container Service)

-- 마스터 노드 생성






- 클러스터가 만들어지면 EC2로 워커 노드를 만들어야 함
-- kubectl 설치






-- 워커노드 만들기












--- Pod
=> 마스터 노드에서 실행
# mkdir workspace && cd $_ 
# kubectl get node 
# kubectl run nginx-pod --image=nginx 
# kubectl expose pod nginx-pod --name clusterip --type=ClusterIP --port 80 
# kubectl expose pod nginx-pod --name nodeport --type=NodePort --port 80 
# kubectl expose pod nginx-pod --name loadbalancer --type=LoadBalancer --external-ip 192.168.56.103 --port 80
=> port는 타깃 포트를 의미, nginx라는 pod는 80포트가 오픈되어 있음
# kubectl get pod 
# kubectl get service 
# kubectl exec -it nginx-pod -- bash

# kubectl get all 
# kubectl delete svc --all 
# kubectl delete pod nginx-pod
'KOSA 클라우드 솔루션즈 아키텍트 양성과정' 카테고리의 다른 글
| [7.25] 참고 (0) | 2022.07.26 | 
|---|---|
| [7.22] kubernetes(EKS에서 Deployment.yaml 실행) (0) | 2022.07.22 | 
| [7.20] kubernetes(도커 이미지 pull 횟수 제한, ResourceQuota, taint, labels) (0) | 2022.07.20 | 
| [7.19] kubernetes(metallb, nfs-pv-pvc) (0) | 2022.07.19 | 
| [7.18]kubernetes(deployment, volume) (0) | 2022.07.18 |