$pip install awscli
- AmazonEC2FullAccess
- AmazonRoute53FullAccess
- AmazonS3FullAccess
- AmazonVPCFullAccess
$aws configure
AWS Access Key ID [None]: AccessKeyValue
AWS Secret Access Key [None]: SecretAccessKeyValue
Default region name [None]: us-east-1
Default output format [None]:
Install kops by following its official installation guide.
$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
$kops version
Install kubectl by following its official installation guide
$curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
$curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl
$chmod +x ./kubectl
$sudo mv ./kubectl /usr/local/bin/kubectl
$kubectl --version
$bucket_name=sample-kops-state-store
$aws s3 mb s3://${bucket_name} --region us-west-2
Provide a name for the Kubernetes cluster and set the S3 bucket URL in the following environment variables.
export KOPS_CLUSTER_NAME=sample.com
export KOPS_STATE_STORE=s3://${bucket_name}
kops create cluster --help
$kops create cluster \
--state=${KOPS_STATE_STORE} \
--node-count=2 \
--master-size=t2.micro \
--node-size=t2.micro \
--zones=us-west-1a \
--name=${KOPS_CLUSTER_NAME}
kops create secret sshpublickey admin -i ~/.ssh/id_rsa.pub --name=${KOPS_CLUSTER_NAME} --state=${KOPS_STATE_STORE}
$kops edit cluster --name=${KOPS_CLUSTER_NAME} --state=${KOPS_STATE_STORE}
$kops update cluster --name=${KOPS_CLUSTER_NAME} --state=${KOPS_STATE_STORE} --yes
Above command may take some time to create the required infrastructure resources on AWS. Execute the validate command to check its status and wait until the cluster becomes ready
$kops validate cluster --state=${KOPS_STATE_STORE} --name=${KOPS_CLUSTER_NAME}
$kubectl cluster-info
$ssh -i ~/.ssh/id_rsa admin@api.sample.com
This site was built using GitHub Pages.