Coder Social home page Coder Social logo

kubernetes's Introduction

How to install a Kubernetes cluster

CI

You need to run a BASH shell. You can do it as root or as a normal user:

sudo su --login root

Remove unwanted aliases if necessary:

unalias rm cp mv

Check that you have the necessary AWS credentials available:

aws configure

Install git and docker if not yet available:

sudo yum install -y docker git
sudo systemctl enable --now docker

First create the infrastructure in AWS

On Cloud9:

dir=${HOME}/environment
github_username=sebastian-colomar
github_repository=kubernetes
github_branch=main

git clone https://github.com/${github_username}/${github_repository} --single-branch -b ${github_branch} ${dir}/${github_repository}

# CHOOSE THE CONFIGURATION FOR YOUR CLUSTER DEPENDING ON THE REGION AND PROTOCOL
cluster=mumbai-kubelet-3masters-3workers-https

# CHOOSE YOUR OPERATING SYSTEM
os=rhel8
os=ubuntu18

# CHOOSE YOUR CONTAINER ENGINE
engine=containerd
engine=cri-o
engine=docker

location=${dir}/${github_repository}/${os}/${engine}/etc/aws/${cluster}.yaml

aws cloudformation create-stack --stack-name ${os}-${engine}-${cluster}-$( date +%s ) --template-body file://${location} --capabilities CAPABILITY_NAMED_IAM --parameters ParameterKey=RecordSetName,ParameterValue=kubernetes-${os}-${engine}

How to install a Kubernetes cluster with 3 masters and any number of workers

On the leader (master1):

bash
dir=/tmp
github_username=sebastian-colomar
github_repository=kubernetes
github_branch=main

# CHOOSE YOUR OPERATING SYSTEM
os=rhel8
os=ubuntu18

# CHOOSE YOUR CONTAINER ENGINE
engine=containerd
engine=cri-o
engine=docker

git clone https://github.com/${github_username}/${github_repository} --single-branch -b ${github_branch} ${dir}/${github_repository}
source ${dir}/${github_repository}/${os}/${engine}/bin/install-leader.sh

On the master2 and master3:

bash
dir=/tmp
github_username=sebastian-colomar
github_repository=kubernetes
github_branch=main

# CHOOSE YOUR OPERATING SYSTEM
os=rhel8
os=ubuntu18

# CHOOSE YOUR CONTAINER ENGINE
engine=containerd
engine=cri-o
engine=docker

git clone https://github.com/${github_username}/${github_repository} --single-branch -b ${github_branch} ${dir}/${github_repository}
# EXPORT THE FOLLOWING VARIABLES FROM THE OUTPUT OF THE LEADER
export ip_leader=xxx
export token_certificate=xxx
export token_discovery=xxx
export token_token=xxx
export kube=kube-xxx
source ${dir}/${github_repository}/${os}/${engine}/bin/install-master.sh

On the workers:

bash
dir=/tmp
github_username=sebastian-colomar
github_repository=kubernetes
github_branch=main

# CHOOSE YOUR OPERATING SYSTEM
os=rhel8
os=ubuntu18

# CHOOSE YOUR CONTAINER ENGINE
engine=containerd
engine=cri-o
engine=docker

git clone https://github.com/${github_username}/${github_repository} --single-branch -b ${github_branch} ${dir}/${github_repository}
# EXPORT THE FOLLOWING VARIABLES FROM THE OUTPUT OF THE LEADER
export token_discovery=xxx
export token_token=xxx
export kube=kube-xxx
export ip_master1=xxx
# EXPORT THE FOLLOWING VARIABLES FROM THE OUTPUT OF THE MASTERS
export ip_master2=xxx
export ip_master3=xxx
source ${dir}/${github_repository}/${os}/${engine}/bin/install-worker.sh

How to install a Kubernetes cluster with 1 single master and any number of workers

On the leader (master1):

bash
dir=/tmp
github_username=sebastian-colomar
github_repository=kubernetes
github_branch=main

# CHOOSE YOUR OPERATING SYSTEM
os=rhel8
os=ubuntu18

# CHOOSE YOUR CONTAINER ENGINE
engine=containerd
engine=cri-o
engine=docker

git clone https://github.com/${github_username}/${github_repository} --single-branch -b ${github_branch} ${dir}/${github_repository}
source ${dir}/${github_repository}/${os}/${engine}/bin/install-leader.sh

On the workers:

bash
dir=/tmp
github_username=sebastian-colomar
github_repository=kubernetes
github_branch=main

# CHOOSE YOUR OPERATING SYSTEM
os=rhel8
os=ubuntu18

# CHOOSE YOUR CONTAINER ENGINE
engine=containerd
engine=cri-o
engine=docker

git clone https://github.com/${github_username}/${github_repository} --single-branch -b ${github_branch} ${dir}/${github_repository}
# EXPORT THE FOLLOWING VARIABLES FROM THE OUTPUT OF THE LEADER
export token_discovery=xxx
export token_token=xxx
export kube=kube-xxx
export ip_master1=xxx
source ${dir}/${github_repository}/${os}/${engine}/bin/install-worker-singlemaster.sh

kubernetes's People

Contributors

academiaonline avatar scolomar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

kubernetes's Issues

Failed because of wrong branch

`++ git clone --single-branch --branch docker https://github.com/sebastian-colomar/nlb /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90
Cloning into '/tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90'...
warning: Could not find remote branch docker to clone.
fatal: Remote branch docker not found in upstream origin
++ sed --in-place s/worker/manager/ /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/etc/swarm/manifests/nlb.yaml
sed: can't read /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/etc/swarm/manifests/nlb.yaml: No such file or directory
++ sed --in-place s/port_master/6443/ /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/etc/swarm/manifests/nlb.yaml
sed: can't read /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/etc/swarm/manifests/nlb.yaml: No such file or directory
++ sed --in-place s/port_master/6443/ /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf
sed: can't read /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf: No such file or directory
++ sed --in-place s/ip_master1/10.168.1.100/ /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf
sed: can't read /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf: No such file or directory
++ sed --in-place s/ip_master2/10.168.3.100/ /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf
sed: can't read /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf: No such file or directory
++ sed --in-place s/ip_master3/10.168.5.100/ /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf
sed: can't read /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/secrets/etc/nginx/conf.d/default.conf: No such file or directory
++ sudo cp --recursive --verbose '/tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/' /run
cp: cannot stat '/tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/run/
': No such file or directory
++ sudo docker swarm init
Swarm initialized: current node (71o9f7v08ase034qjopjqmhu2) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join --token SWMTKN-1-3ru2ozuobhbar5bl3t10jkbv0d2oaqlh2aez108zepp3rz12ts-2thzvpmwarxkg7a509z4y2ebh 10.168.1.219:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

++ sudo docker stack deploy --compose-file /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/etc/swarm/manifests/nlb.yaml nlb
open /tmp/1eca2500-3cd0-4f7f-928d-5807d6652c90/etc/swarm/manifests/nlb.yaml: no such file or directory`

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.