Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit 38f49d7

Browse files
authored
Merge pull request #478 from buzzsurfr/master
create-kubeconfig.sh and .bashrc
2 parents c414adf + af287e1 commit 38f49d7

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Create kubeconfig script
2+
#title create-kubeconfig.sh
3+
#description This script will create a kubeconfig file based on the EKS cluster k8s-workshop.
4+
#author @buzzsurfr
5+
#contributors @buzzsurfr @dalbhanj @cloudymind
6+
#date 2018-06-07
7+
#version 0.2
8+
#usage curl -sSL https://s3.amazonaws.com/aws-kubernetes-artifacts/v0.5/create-kubeconfig.sh | bash -s stable
9+
#==============================================================================
10+
11+
# Download kubeconfig template
12+
mkdir $HOME/.kube
13+
aws s3 cp s3://aws-kubernetes-artifacts/v0.5/config-k8s-workshop $HOME/.kube/config
14+
15+
# Configure based on EKS cluster k8s-workshop
16+
sed -i -e "s#<endpoint-url>#$(aws eks describe-cluster --name k8s-workshop --query cluster.endpoint --output text)#g" $HOME/.kube/config
17+
sed -i -e "s#<base64-encoded-ca-cert>#$(aws eks describe-cluster --name k8s-workshop --query cluster.certificateAuthority.data --output text)#g" $HOME/.kube/config
18+
sed -i -e "s#<cluster-name>#k8s-workshop#g" $HOME/.kube/config
19+
sed -i -e "s#<role-arn>#$EKS_SERVICE_ROLE#g" $HOME/.kube/config

01-path-basics/101-start-here/scripts/lab-ide-build.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ export EKS_SECURITY_GROUPS=$(aws cloudformation describe-stacks --stack-name $AW
5252
export EKS_SERVICE_ROLE=$(aws cloudformation describe-stacks --stack-name $AWS_MASTER_STACK | jq -r '.Stacks[0].Outputs[]|select(.OutputKey=="EksServiceRoleArn")|.OutputValue')
5353

5454
# Persist lab variables
55-
echo "AWS_AVAILABILITY_ZONES=$AWS_AVAILABILITY_ZONES" >> ~/.bash_profile
56-
echo "KOPS_STATE_STORE=$KOPS_STATE_STORE" >> ~/.bash_profile
57-
echo "export AWS_AVAILABILITY_ZONES KOPS_STATE_STORE" >> ~/.bash_profile
55+
echo "AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION" >> ~/.bashrc
56+
echo "AWS_AVAILABILITY_ZONES=$AWS_AVAILABILITY_ZONES" >> ~/.bashrc
57+
echo "KOPS_STATE_STORE=$KOPS_STATE_STORE" >> ~/.bashrc
5858

5959
# Persist EKS variables
60-
echo "EKS_VPC_ID=$EKS_VPC_ID" >> ~/.bash_profile
61-
echo "EKS_SUBNET_IDS=$EKS_SUBNET_IDS" >> ~/.bash_profile
62-
echo "EKS_SECURITY_GROUPS=$EKS_SECURITY_GROUPS" >> ~/.bash_profile
63-
echo "EKS_SERVICE_ROLE=$EKS_SERVICE_ROLE" >> ~/.bash_profile
60+
echo "EKS_VPC_ID=$EKS_VPC_ID" >> ~/.bashrc
61+
echo "EKS_SUBNET_IDS=$EKS_SUBNET_IDS" >> ~/.bashrc
62+
echo "EKS_SECURITY_GROUPS=$EKS_SECURITY_GROUPS" >> ~/.bashrc
63+
echo "EKS_SERVICE_ROLE=$EKS_SERVICE_ROLE" >> ~/.bashrc
6464

6565
# EKS-Optimized AMI
6666
if [ "$AWS_DEFAULT_REGION" == "us-east-1" ]; then
6767
export EKS_WORKER_AMI=ami-dea4d5a1
6868
elif [ "$AWS_DEFAULT_REGION" == "us-west-2" ]; then
6969
export EKS_WORKER_AMI=ami-73a6e20b
7070
fi
71-
echo "EKS_WORKER_AMI=$EKS_WORKER_AMI" >> ~/.bash_profile
71+
echo "EKS_WORKER_AMI=$EKS_WORKER_AMI" >> ~/.bashrc
7272

7373
# Create SSH key
7474
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa

0 commit comments

Comments
 (0)