Install awscli (Mac)
brew install awscli
aws --version
aws configure
AWS Access Key ID: ${Access key ID}
AWS Secret Access Key: ${Secret access key}
Default region name: ${region} // ap-northeast-2(seoul)
Default output format: json
Create ECR
1. go to https://console.aws.amazon.com/ecr/
2. choose to get started.
3. choose tag immutability
4. scan on push
Login ECR with awscli
After you have installed and configured the AWS CLI, authenticate the Docker CLI to your default registry. That way, the docker command can push and pull images with Amazon ECR. The AWS CLI provides a get-login-password command to simplify the authentication process.
To authenticate Docker to an Amazon ECR registry with get-login-password, run the aws ecr get-login-password command. When passing the authentication token to the docker login command, use the value AWS for the username and specify the Amazon ECR registry URI you want to authenticate to. If authenticating to multiple registries, you must repeat the command for each registry.
Get-login-pawword
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 713814976737.dkr.ecr.ap-northeast-2.amazonaws.com
Create a Repository
repository name: k8s-board-fe, k8s-board-api
aws ecr create-repository \ --repository-name k8s-board-fe \ --image-scanning-configuration scanOnPush=true \ --region ap-northeast-2
aws ecr create-repository \ --repository-name k8s-board-api \ --image-scanning-configuration scanOnPush=true \ --region ap-northeast-2
- Seoul: ap-northeast-2
Docker Push
docker build -t 713814976737.dkr.ecr.ap-northeast-2.amazonaws.com/k8s-board-fe:v1 .
docker push 713814976737.dkr.ecr.ap-northeast-2.amazonaws.com/k8s-board-fe:v1
docker build -t 713814976737.dkr.ecr.ap-northeast-2.amazonaws.com/k8s-board-api:v1 .
docker push 713814976737.dkr.ecr.ap-northeast-2.amazonaws.com/k8s-board-api:v1
Create & Delete EKS cluster
create a dev cluster
eksctl create cluster --name dev --version 1.16 --region ap-northeast-2 --nodegroup-name standard-workers --node-type t2.small --nodes 2 --nodes-min 1 --nodes-max 2 --managed
delete a dev cluster
eksctl delete cluster --name=dev
scale up or down
eksctl scale nodegroup --cluster dev --name standard-workers --nodes 1
Create Namespace
kubectl create namespace api
kubectl create namespace front
kubectl create namespace db
projectcontour
kubectl apply -f https://projectcontour.io/quickstart/contour.yaml
dev-eks or prod-eks
skaffold dev -f skaffold.yaml -p eks -t v1
skaffold run -f skaffold.yaml -p eks -t v1
Available pod at EKS
kubectl get nodes -o yaml | grep pods
kubectl get pods --all-namespaces | grep Running | wc -l
EKS price
You pay $0.10 per hour for each Amazon EKS cluster that you create
EC2 price (work nodes)
Name | vCPUs | RAM (GiB) | CPU Credits/hr | On-Demand Price/hr* | 1-yr Reserved Instance Effective Hourly* | 3-yr Reserved Instance Effective Hourly* |
---|---|---|---|---|---|---|
t2.nano | 1 | 0.5 | 3 | $0.0058 | $0.003 | $0.002 |
t2.micro | 1 | 1.0 | 6 | $0.0116 | $0.007 | $0.005 |
t2.small | 1 | 2.0 | 12 | $0.023 | $0.014 | $0.009 |
t2.medium | 2 | 4.0 | 24 | $0.0464 | $0.031 | $0.021 |
t2.large | 2 | 8.0 | 36 | $0.0928 | $0.055 | $0.037 |
t2.xlarge | 4 | 16.0 | 54 | $0.1856 | $0.110 | $0.074 |
t2.2xlarge | 8 | 32.0 | 81 | $0.3712 | $0.219 | $0.148 |
- $0.1 * 24 = $2.4
- $0.023 * 24 = $0.552
= $2.952
ECR
Region: Asia Pacific (Seoul)
Pricing | |
---|---|
Data Transfer IN | |
All data transfer in | $0.00 per GB |
Data Transfer OUT ** | |
Up to 1 GB / Month | $0.00 per GB |
Next 9.999 TB / Month | $0.126 per GB |
Next 40 TB / Month | $0.122 per GB |
Next 100 TB / Month | $0.117 per GB |
Greater than 150 TB / Month | $0.108 per GB |