Giter Club home page Giter Club logo

kops-kubernetes-cluster-configuration's Introduction

kops-kubernetes-cluster-configuration

Landmark Technologies, - Landmark Technologies

Tel: +1 437 215 2483, - +1 437 215 2483

Setting up Kubernetes (K8s) Cluster on AWS Using KOPS

1.kops is a software use to create production ready k8s cluster in a cloud provider like AWS.

  1. kOPS SUPPORTS MULTIPLE CLOUD PROVIDERS

  2. Kops compete with managed kunbernestes services like EKS, AKS and GKE

  3. Kops is cheaper than the others.

  4. Kops create production ready K8S.

  5. KOPS create resources like: LoadBalancers, ASG, Launch Configuration, woker node Master node (CONTROL PLANE.

  6. KOPS is IaaC

#!/bin/bash

1) Create Ubuntu EC2 instance in AWS

2) install AWSCLI

sudo apt update -y sudo apt install unzip wget -y sudo curl https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundle.zip sudo apt install unzip python -y sudo unzip awscli-bundle.zip sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

3) Install kops software on ubuntu instance:

#Install wget if not installed
sudo apt install wget -y
sudo wget https://github.com/kubernetes/kops/releases/download/v1.16.1/kops-linux-amd64
sudo chmod +x kops-linux-amd64
sudo mv kops-linux-amd64 /usr/local/bin/kops

4) Install kubectl

sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl sudo chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl aws s3 mb s3://nubonglegah.k8.local aws s3 ls

5) Create an IAM role from AWS Console or CLI with below Policies.

AmazonEC2FullAccess 
AmazonS3FullAccess
IAMFullAccess 
AmazonVPCFullAccess

Then Attach IAM role to ubuntu server from Console Select KOPS Server --> Actions --> Instance Settings --> Attach/Replace IAM Role --> Select the role which You Created. --> Save.

6) create an S3 bucket Execute below commond in KOPS Server use unique bucket name if you get bucket name exists error.

aws s3 mb s3://class21.k8s.local
aws s3 ls

ex: s3://nubong.k8s.local
 
Expose environment variable:

# Add env variables in bashrc
vi .bashrc

# Give Unique Name And S3 Bucket which you created.
export NAME=class21.k8s.local
export KOPS_STATE_STORE=s3://class21.k8s.local

source .bashrc

7) Create sshkeys before creating cluster

ssh-keygen

8) Create kubernetes cluster definitions on S3 bucket

kops create cluster --zones us-east-2c --networking weave --master-size t2.medium --master-count 1 --node-size t2.large --node-count=2 ${NAME}


kops create secret --name ${NAME} sshpublickey admin -i ~/.ssh/id_rsa.pub

9) Create kubernetes cluser

 kops update cluster ${NAME} --yes

10) Validate your cluster(KOPS will take some time to create cluster ,Execute below commond after 3 or 4 mins)

   kops validate cluster

11) To list nodes

  kubectl get nodes 

12) To Delete Cluster

kops delete cluster --name=${NAME} --state=${KOPS_STATE_STORE} --yes

====================================================================================================

13 # IF you wan to SSH to Kubernates Master or Nodes Created by KOPS. You can SSH From KOPS_Server

ssh admin@ it above command is not working then execute ssh -i ~/.ssh/id_rsa admin@

kops-kubernetes-cluster-configuration's People

Contributors

legah2045 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.