Just.Give.Me.Commands.

# to make sure kops will load your ~/.aws/config
export AWS_SDK_LOAD_CONFIG=1
# tell tools below which profile they should use to authenticate with AWS
export AWS_PROFILE=default
# k8s cluster name
NAME=example
# AWS region to deploy to
REGION=us-east-2

# create S3 bucket for storing kops state
aws s3 mb s3://$NAME-kops-state --region $REGION

# spin up k8s cluster
kops create cluster \
--name $NAME.k8s.local \
--zones=${REGION}a \
--master-zones=${REGION}a \
--networking kube-router \
--dns=private \
--topology=private \
--node-count=4 \
--node-size=c5.large \
--master-size=t3.medium --master-count=1 \
--ssh-public-key ~/.ssh/id_rsa.pub \
--state s3://$NAME-kops-state \
--cloud=aws \
--yes

# make sure everything provisioned correctly
kops validate cluster --state s3://$NAME-kops-state

# allow cluster instances to access S3
aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess --role-name nodes.$NAME.k8s.local

# set up needed values in example.env.yaml

# populate environment config
tokendctl gen env -f example.env.yaml -o $NAME.env.yaml

# generate k8s deployment
tokendctl gen k8s -f $NAME.env.yaml -o $NAME.k8s.yaml

# deploy TokenD resources to the k8s cluster
kubectl apply -f $NAME.k8s.yaml

results matching ""

    No results matching ""