본문 바로가기

Infra/쿠버네티스 입문

쿠버네티스 입문 (9) - 베스천 서버와 k8s 실행

728x90

- 베스천 서버를 만들어서, 터미널을 실행한다.

- 인바운드를 지정할 수 있으니 더욱 보안적으로 유리하다.

 

1: Install eksctl
------------------

curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp

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

2: Update AWS CLI to Version 2
------------------------------

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Now log out of your shell and back in again.

3: Set up a Group
-----------------

Set up a group with the Permissions of:

AmazonEC2FullAccess
IAMFullAccess
AWSCloudFormationFullAccess

You also need to create an inline policy, using the following:
--------------------------------------------------------------

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "eks:*",
      "Resource": "*"
    },
    {
      "Action": [
        "ssm:GetParameter",
        "ssm:GetParameters"
      ],
      "Resource": "*",
      "Effect": "Allow"
    }
  ]
}


4: Add a user to the group
--------------------------

Use the console to add a user to your new group, and then use "aws configure" to input the credentials

5: Install kubectl
------------------

Warning: check the current default kubernetes version supplied with EKS and install a matching version of kubectl

export RELEASE=<enter default eks version number here. Eg 1.17.0>
curl -LO https://storage.googleapis.com/kubernetes-release/release/v$RELEASE/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

Check the version with "kubectl version --client"


6: Start your cluster!
----------------------

eksctl create cluster --name fleetman --nodes-min=3

 

- 1 ~ 6 단계까지 세팅해서 eksctl을 설치하고 aws 계정을 세팅한 후, 클러스터를 생성한다.

- 클러스터는 고비용이고 생성할 때 20분 정도 소요된다.

300x250