GithubHelp home page GithubHelp logo

kubernetes's Introduction

kubernetes setup using kubeadm

It is an open source platform used to deploy, manage and maintain a group of containers. it is an Ubuntu based platform. It is used most commonly together with Docker for better control of containerized applications.

Prerequisites

  • I assume you know how to deploy a virtual machine ๐Ÿ–ฅ Ubuntu preferably.
  • basic knowledge of the linux file system | ownership | permissions ๐Ÿง
  • basic knowledge of git ๐Ÿšฆ
  • stable internet connection (very important)โ˜๏ธ
  • How to use linux editor vim or at least nano ๐Ÿ“
  • a cup of coffee โ˜•๏ธ

SETUP

step 1

We will be installing and updating the apt repository before installing any package

sudo apt-get update
swapoff -a

step 2

Now that our installer is up to date, next is to use following command to install packages using https

 sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

step 3

Next is to install Docker with the following commands

 sudo mkdir -m 0755 -p /etc/apt/keyrings
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Now let's set up the repo with the following command

 echo \
   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Run this command to update the package:

 sudo apt-get update

Containerd is an important component for kubernetes to function, run ''' sudo apt install containerd.io ''' Open the /etc/containerd/conf.toml file, and comment out disabled_plugins

''' nano /etc/containerd/conf.toml ''' As it's in the output below:

image

step 4

After installing Docker with the above step, Let's restart containerd service

sudo systemctl restart containerd.service

step 5

Next is to install kubernetes using the following commands. ''' sudo apt-get install -y apt-transport-https ca-certificates curl '''

Download the Google Cloud public signing key:

sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg| sudo apt-key add

step 6

Let's add the Kubernetes APT repository with: ''' echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list '''

step 7

Let's install kubernetes components with

sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni
sudo apt-mark hold kubelet kubeadm kubectl

The hold flag would prevent updates to the kubernetes components installed.

Next is to do

nano /etc/sysctl.conf

to uncomment the line below

image

step 8

Followed by this command to confirm

sysctl -p

Also run this command which works intelligently to add any dependent modules automatically.

sudo modprobe br_netfilter

All the above are run on all the 3 nodes ( one master and 2 workers ).

step 9

Next is to Initialize the master node using the following command: NOTE- YOU NEED TO REPLACE YOUR MASTER NODE IP ADDRESS BELOW

 kubeadm init --pod-network-cidr 10.244.0.0/16 --apiserver-advertise-address=120.31.12.56

To start using the cluster, Exit root user, we need to run the following

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

Use the command below to list the nodes ''' kubectl get nodes '''

step 9

we need to install a network solution using the following command: This will help to manage the clusters network.

# Install Weave Net
kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml
#List the necessary dependency as they start running on the control plane
kubectl get pods -n kube-system

step 10

To see all the nodes and show that master node is ready, run

kubectl get nodes

step 11

The last step is to configure the worker nodes.

Join the worker node to the master node/control plane from the picture below which we got when we initialize kubeadm for the master mode earlier on

worker nodes join picture

Note that i encountered the error below

image and i debugged it with This

kubernetes's People

Contributors

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