KOPS — AWS¶
Links¶
- https://jee-appy.blogspot.com.br/2017/10/setup-kubernetes-cluster-kops-aws.html
- https://github.com/kubernetes/kops/blob/master/docs/high_availability.md
- https://aws.amazon.com/pt/blogs/compute/kubernetes-clusters-aws-kops/
- https://kubernetes.io/docs/getting-started-guides/kops/
Install kubectl¶
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
Install kops¶
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
chmod +x kops-linux-amd64
sudo mv kops-linux-amd64 /usr/local/bin/kops
Install AWS CLI¶
https://docs.aws.amazon.com/pt_br/cli/latest/userguide/installing.html
Setup IAM user¶
Required policies:
AmazonEC2FullAccessAmazonRoute53FullAccessAmazonS3FullAccessIAMFullAccessAmazonVPCFullAccess
Create IAM user from the command line¶
/root/.local/bin/aws iam create-group --group-name kops
/root/.local/bin/aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess --group-name kops
/root/.local/bin/aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonRoute53FullAccess --group-name kops
/root/.local/bin/aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess --group-name kops
/root/.local/bin/aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/IAMFullAccess --group-name kops
/root/.local/bin/aws iam attach-group-policy --policy-arn arn:aws:iam::aws:policy/AmazonVPCFullAccess --group-name kops
/root/.local/bin/aws iam create-user --user-name kops
/root/.local/bin/aws iam add-user-to-group --user-name kops --group-name kops
iam create-access-key --user-name kops
You should record the SecretAccessKey and AccessKeyID in the returned JSON output, and then use them below:
# configure the aws client to use your new IAM user
aws configure # Use your new access and secret key here
aws iam list-users # you should see a list of all your IAM users here
# Because "aws configure" doesn't export these vars for kops to use, we export them now
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
Create public key¶
Amazon S3 bucket for the Kubernetes state store¶
Versioning the bucket¶
aws s3api put-bucket-versioning --bucket kubernetes-BUCKET-NAME --versioning-configuration Status=Enabled
DNS¶
Enable "auto dns" in cluster creation: .k8s.local. The only requirement to trigger this is to have the cluster name end with .k8s.local.
Create Cluster¶
Create HA Cluster¶
https://github.com/kubernetes/kops/blob/master/docs/high_availability.md