Skip to content

Instantly share code, notes, and snippets.

View felipecosta09's full-sized avatar
:octocat:
Focusing

Felipe Costa felipecosta09

:octocat:
Focusing
View GitHub Profile
@felipecosta09
felipecosta09 / kubectl.sh
Last active April 11, 2020 06:47
Install Kubectl
# Install Kubectl
curl -Lo kubectl 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
@felipecosta09
felipecosta09 / s3bucket.sh
Last active April 11, 2020 07:38
S3 Bucket Creation
#Create Bucket
aws s3api create-bucket --bucket prefix-example-com-state-store --region us-east-1
#Enable Versioning
aws s3api put-bucket-versioning --bucket prefix-example-com-state-store --versioning-configuration Status=Enabled
#Enable Bucket Encryption
@felipecosta09
felipecosta09 / awsazcheck.sh
Last active April 10, 2020 11:35
Check AZs us-east-1
# Check AZ's in us-east-1
aws ec2 describe-availability-zones --region us-east-1
{
"AvailabilityZones": [
{
"OptInStatus": "opt-in-not-required",
"Messages": [],
"ZoneId": "use1-az6",
"GroupName": "us-east-1",
@felipecosta09
felipecosta09 / kops.sh
Last active April 10, 2020 11:34
Install KOPS
#Install KOPS
curl -Lo kops 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
sudo mv ./kops /usr/local/bin/
@felipecosta09
felipecosta09 / kopsev.sh
Last active April 10, 2020 11:35
KOPS Env
# Set Environment Variables for KOPS
export NAME=YourClusterName.k8s.local
export KOPS_STATE_STORE=s3://YourS3BucketName
@felipecosta09
felipecosta09 / kopscreate.sh
Last active April 10, 2020 11:41
Create KOPS Cluster Configuration
# Create KOPS Cluster Configuration
kops create cluster --zones us-east-1a,us-east-1b,us-east-1c ${NAME}
------------------------------------------------------------------------------
# Result
[root@ec2-user] kops create cluster --zones us-east-1a,us-east-1b,us-east-1c ${NAME}
I0408 11:25:53.884925 26564 create_cluster.go:562] Inferred --cloud=aws from zone "us-east-1a"
@felipecosta09
felipecosta09 / kopssshkey.sh
Created April 10, 2020 11:44
KOPS ssh key
# Generate a ssh key for KOPS
ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa
kops create secret --name ${NAME} sshpublickey admin -i ~/.ssh/id_rsa.pub
@felipecosta09
felipecosta09 / kopsmaster.sh
Created April 10, 2020 11:46
KOPS Master Node Configuration
# Edit KOPS Master Node Configuration
kops edit cluster ${NAME}
@felipecosta09
felipecosta09 / kopsworkernodes.sh
Last active April 11, 2020 07:21
KOPS Worker Nodes Configuration
# Edit KOPS Worker Nodes Configuration
kops edit ig nodes --name ${NAME}
---------------------------------------------
# Result
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
@felipecosta09
felipecosta09 / kopsconfig.sh
Last active April 10, 2020 13:05
KOPS Configuration
# Get KOPS Configuration
kops get ig --name ${NAME}
-------------------------------
# Result
[root@ip-172-31-41-51 ec2-user]# kops get ig --name ${NAME}
NAME ROLE MACHINETYPE MIN MAX ZONES