Installation of Kubernetes with Kubespray

My Test Environment Topology
Disable SELINUXsetenforce 0 && \
sed -i "s/^SELINUX\=enforcing/SELINUX\=disabled/g" /etc/selinux/config && \
sed -i "s/^SELINUX\=permissive/SELINUX\=disabled/g" /etc/selinux/config && \
systemctl disable firewalld; systemctl stop firewalld; systemctl mask firewalld
Load "br_netfilter" module persistent for K8Ssudo modprobe br_netfilter
echo "br_netfilter" >> /etc/modules-load.d/br_netfilter.conf
echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
echo 'net.bridge.bridge-nf-call-iptables=1' | sudo tee -a /etc/sysctl.conf
reboot
We can check this with to below commands outputs
lsmod | grep -i br_netfilter
cat /proc/sys/net/bridge/bridge-nf-call-iptables
Create user with root permissions for installation. (This user must create also on Host machine)adduser kubespray
sed -i '/visiblepw/i Defaults \!requiretty' /etc/sudoers
echo 'kubespray ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/kubespray
Firstly, we  are generating public keykubespray@master-pc:~/.ssh$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/kubespray/.ssh/id_rsa): k8s-lisbon
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/kubespray/.ssh/k8s-lisbon
Your public key has been saved in /home/kubespray/.ssh/k8s-lisbon.pub
kubespray@master-pc:~/.ssh$ ls -la
total 20
drwx------ 2 kubespray kubespray 4096 Tem 1 00:00 .
drwxr-xr-x 5 kubespray kubespray 4096 Haz 30 12:39 ..
-rw------- 1 kubespray kubespray 2610 Tem 1 00:00 k8s-lisbon
-rw-r--r-- 1 kubespray kubespray 573 Tem 1 00:00 k8s-lisbon.pub
and, Copy public key to kubernetes nodes.kubespray@master-pc:~/.ssh$ ssh-copy-id -i k8s-lisbon.pub kubespray@<ip-address>
$ su - kubespray
$ git clone https://github.com/kubernetes-sigs/kubespray.git
$ cd /kubespray/
$ sudo pip install -r requirements.txt
kubespray@master-pc:~/kubespray/inventory/k8s-lisbon$ export CLUSTER_NAME="k8s-lisbon"
kubespray@master-pc:~/kubespray/inventory/k8s-lisbon$ export CLUSTER_DOMAIN="k8s-lisbon"
kubespray@master-pc:~/kubespray/inventory/k8s-lisbon$ export CLUSTER_FQDN="$CLUSTER_NAME.$CLUSTER_DOMAIN"
$ mkdir inventory/$CLUSTER_NAME
$ cp -rfp inventory/sample/* inventory/$CLUSTER_NAME/
$ mv inventory/$CLUSTER_NAME/inventory.ini inventory/$CLUSTER_NAME/inventory.cfg
- kube_read_only_port: 10255
- kube_version: v1.21.1
- kube_api_anonymous_auth: true
- cluster_name: k8s-lisbon
- kube_network_plugin: calico
ansible-playbook -u $(whoami) -b -i inventory/$CLUSTER_NAME/inventory.cfg cluster.yml

--

--

--

IT Internal Controller

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Android Intents using Library

BootStrap VS Tailwind CSS [Future Of UI Framework 2021]

Humza Sajid Software Enginner

Rotate Image LeetCode — Javascript and Python Walkthrough

Random Beacon Alpha API Demo App

A post on Agile Methodology — Developing Zomato App features!

Create Identity in Google Cloud Platform and GSuite

The Rise of Serverless Computing

Get any website IP Address using Python!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mert Özdemir

Mert Özdemir

IT Internal Controller

More from Medium

Keeping Secrets hidden on public github repository during deployment to Kubernetes cluster

Development Kubernetes cluster under 3 minutes

Kubernetes and its Use-Cases

Multiple Schedulers in Kubernetes