AWS Managed K8S 관리 서비스인 EKS를 설치하는 방법을 가이드한다.

로컬에서 작업을 해도 무방하나 나는 EC2를 하나 생성한 후 거기에서 리눅스 명령어를 통해 EKS 클러스터를 생성했다.

mkdir bin 디렉토리 (/home/ec2-user/bin)

1. path에 $USER-HOME/bin 디렉토리 추가

vim .bash_profile

[.bash_profile]

PATH=$PATH:$HOME/.local/bin:$HOME/bin
source ./.bash_profile

2. install eksctl

sudo mv -v /tmp/eksctl /usr/local/bin

eksctl version

3. install kubectl

sudo chmod +x /home/ec2-user/bin/kubectl

4. install jq, envsubst

bash sudo yum -y install jq gettext

5. create eks cluster

eksctl create cluster --name eks-cluster \
 --version 1.14 \
 --nodegroup-name k8s-worker \
 --node-type t3.medium \
 --nodes 3 \
 --node-ami auto \
 --region ap-northeast-2
  • create cluster: 클러스터를 생성한다.
  • name eksctl-cluster: eksctl-cluster 라는 EKS 클러스터를 생성한다.
  • version 1.14: k8s 버전을 지정한다. (2019.10.04 현재 k8s는 1.16버전 까지 나왔다)
  • nodegroup-name: k8s-worker worker-node (EC2) 이름을 지정한다.
  • node-type: t3.mediumEC2 type을 지정한다.
  • nodes 3: 노드 개수를 지정한다.
  • node-ami: autoEKS에 최적화된 이미지를 기반으로 생성
  • region: ap-northeast-2ap-northeast-2에서 생성하겠다는 의미

6. kubectl로 클러스터가 연결되었는지 확인한다.

bash kubectl get svc

+ Recent posts