Coder Social home page Coder Social logo

belajar-kubernetes-2's Introduction

Setup K8s on Aws

  1. Create k8s-controll Instance with image ubuntu

  2. Create Role

  • Go to iam
  • Click role
  • CLick add role
  • give tag for youre role
  • add premission (ec2 full, route53 full, s3 full, iam full, vps full)
  1. attach role to instance
  • go to ec2 dashbord
  • select youre instance
  • click action
  • instance seeting
  • Modify IAM role
  • select youre role
  • click save
  1. Create route 53
  • go to route 53
  • click hostedzone
  • click hosted zone
  • input Domain name
  • select youre instance region
  • select youre instance vpcid
  • click created hosted zone
  1. ssh to instance and install aws cli
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
apt install -y unzip python
unzip awscliv2.zip
sudo ./aws/install
  1. 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
  1. 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
  1. config aws cli
aws configure

# AWS Access Key ID [None]:
# AWS Secret Access Key [None]:
# Default region name [None]: us-east-1
# Default output format [None]: json
  1. create s3 bucket
aws s3api create-bucket \
    --bucket k8s-example-store \
    --region us-east-1 # <- example region
    # Note: We STRONGLY recommend versioning your S3 bucket in case you ever need to revert or recover a previous state store.

OR

aws s3 mb s3://k8s-coffeeshopp-apps

# versioning buccket
aws s3api put-bucket-versioning --bucket k8s-devops-store --versioning-configuration Status=Enabled
  1. add to .bashrc
vi .bashrc

# copy line below and put on top of .bashrc file

export KOPS_STATE_STORE=s3://k8s-devops-store
export NAME=k8s.example.com

# run this after copy
source .bashrc
  1. generate ssh password
ssh-keygen
  1. list availibillity zone
aws ec2 describe-availability-zones
  1. create cluster with kops
kops create cluster --cloud=aws --zones=us-east-1a --name=$NAME --node-size=t2.medium --master-size=t2.medium --dns-zone=example.com --dns private

# example
# kops create cluster --cloud=aws --zones=us-east-1a --name=$NAME --node-size=t2.medium --master-size=t2.medium --dns-zone=example.com --dns private
  1. edit configuration
kops edit ig --name=$NAME nodes
kops edit ig --name=$NAME master-us-east-1a
  1. finish and create cluster
kops update cluster --name $NAME --yes
  1. check cluster
kops validate cluster --wait 10m
# or
kops validate cluster
  1. ssh to master node
ssh -i ~/.ssh/id_rsa ubuntu@api.$NAME
  1. delete cluster
kops delete cluster --name=$NAME --state=$KOPS_STATE_STORE --yes

belajar-kubernetes-2's People

Contributors

khannedy avatar adityaudi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.