Skip to content

Commit

Permalink
refine
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh G committed Jan 16, 2023
1 parent 579077d commit a200ea4
Show file tree
Hide file tree
Showing 92 changed files with 308 additions and 0 deletions.
Empty file modified PersistentVolume/persistentvolume-creation-outpu.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified PersistentVolume/pod-creation-output.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified PersistentVolume/pvc-bond-status.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified PersistentVolume/pvc-volume-bond-status.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified PersistentVolume/readme.md
100644 → 100755
Empty file.
Empty file modified PersistentVolume/task-pv-pod.yaml
100644 → 100755
Empty file.
Empty file modified PersistentVolume/task-pv-volume.yaml
100644 → 100755
Empty file.
Empty file modified PersistentVolume/task-pvc-volume.yaml
100644 → 100755
Empty file.
Empty file modified Pod Patterns/adapter-pod.yaml
100644 → 100755
Empty file.
Empty file modified Pod Patterns/ambassador-pod.yaml
100644 → 100755
Empty file.
Empty file modified Pod Patterns/readme.md
100644 → 100755
Empty file.
Empty file modified Pod Patterns/sidecar-pod.yaml
100644 → 100755
Empty file.
Empty file modified deployments/deploy-strategies/readme.md
100644 → 100755
Empty file.
Empty file modified deployments/self-heal-auto-scale/autoscaler-autodiscover.yaml
100644 → 100755
Empty file.
Empty file modified deployments/self-heal-auto-scale/readme.md
100644 → 100755
Empty file.
Empty file modified docker-in-k8s/docker-pod.yaml
100644 → 100755
Empty file.
Empty file modified docker-in-k8s/readme.md
100644 → 100755
Empty file.
Empty file modified general/readme.md
100644 → 100755
Empty file.
Empty file modified ingress/name-based-vhosts.yaml
100644 → 100755
Empty file.
Empty file modified ingress/pictures/ingress.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified ingress/pictures/name-based-vhosts.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified ingress/readme.md
100644 → 100755
Empty file.
Empty file modified jenkins/deploy.yaml
100644 → 100755
Empty file.
Empty file modified jenkins/master/Dockerfile
100644 → 100755
Empty file.
Empty file modified jenkins/pictures/build-pod-running.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/build-pod-success.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/build-trigger.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/configure-github-server.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/configureCloud-1.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/configureCloud-2.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/configureCloud-3.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/configureCloud-4.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/configureSecurity.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/docker-credentials.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/docker-test-build-job.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/github-pull-request-build-checks.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pictures/github-pull-request-builer.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified jenkins/pipeline/Jenkinsfile
100644 → 100755
Empty file.
Empty file modified jenkins/pipeline/Jenkinsfile.docker-test
100644 → 100755
Empty file.
Empty file modified jenkins/rbac.yaml
100644 → 100755
Empty file.
Empty file modified jenkins/readme.md
100644 → 100755
Empty file.
Empty file modified jenkins/service.yaml
100644 → 100755
Empty file.
Empty file modified jenkins/slave/Dockerfile
100644 → 100755
Empty file.
Empty file modified jenkins/slave/Dockerfile.jnlp-slave
100644 → 100755
Empty file.
Empty file modified jenkins/slave/jenkins-slave
100644 → 100755
Empty file.
Empty file modified multi-containers/Container-terminate.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified multi-containers/Output.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified multi-containers/pod-created.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified multi-containers/pods/two-container-pod.yaml
100644 → 100755
Empty file.
Empty file modified multi-containers/readme.md
100644 → 100755
Empty file.
Empty file modified observability/pictures/image1.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified observability/pictures/image10.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified observability/pictures/image11.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified observability/pictures/image12.png
100644 → 100755
Empty file modified observability/pictures/image13.png
100644 → 100755
Empty file modified observability/pictures/image14.png
100644 → 100755
Empty file modified observability/pictures/image2.png
100644 → 100755
Empty file modified observability/pictures/image3.png
100644 → 100755
Empty file modified observability/pictures/image4.png
100644 → 100755
Empty file modified observability/pictures/image5.png
100644 → 100755
Empty file modified observability/pictures/image6.png
100644 → 100755
Empty file modified observability/pictures/image7.png
100644 → 100755
Empty file modified observability/pictures/image8.png
100644 → 100755
Empty file modified observability/pictures/image9.png
100644 → 100755
Empty file modified observability/pictures/title.png
100644 → 100755
Empty file modified observability/readme.md
100644 → 100755
Empty file.
Empty file modified readme.md
100644 → 100755
Empty file.
75 changes: 75 additions & 0 deletions setup/kubeadm-presetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# Networking and base os setup and installation of basic os libraries
# disable swap
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
sudo swapoff -a

# Enable kernel modules
sudo modprobe overlay
sudo modprobe br_netfilter

# Add some settings to sysctl
sudo tee /etc/sysctl.d/kubernetes.conf<<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF

sudo tee /etc/sysctl.d/k8s.conf<<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
# Reload sysctl
sudo sysctl --system

sudo apt-get update -y
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release gnupg2 software-properties-common

sudo lsmod | grep br_netfilter

# CRI implementation and other related setup
sudo tee /etc/modules-load.d/containerd.conf <<EOF
overlay
br_netfilter
EOF

# Add Docker repo
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Install containerd
sudo apt update
sudo apt install -y containerd.io

# Configure containerd and start service
sudo mkdir -p /etc/containerd
sudo containerd config default>/etc/containerd/config.toml

# restart containerd
sudo systemctl restart containerd
sudo systemctl enable containerd
sudo systemctl status containerd

# Installation of kubeadm, kubelet and kubectl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

sudo apt-get update -y
#Specify a version
sudo apt-get install -y kubelet=1.25.0-00 kubectl=1.25.0-00 kubeadm=1.25.0-00

sudo apt-mark hold kubelet kubeadm kubectl
sudo systemctl enable kubelet

IPADDR=$(wget -qO- http://checkip.amazonaws.com)

sudo rm /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl start kubelet
#sudo kubeadm init --pod-network-cidr=192.168.0.0/16

# curl https://docs.projectcalico.org/manifests/calico.yaml -O
# kubectl apply -f calico.yaml
1 change: 1 addition & 0 deletions setup/kubeadm/.vagrant/bundler/global.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"dependencies":[["vagrant-hostmanager",["= 1.8.9"]],["racc",["~> 1.4"]],["nokogiri",["~> 1.6"]],["diffy",[">= 0"]],["rexml",[">= 0"]],["xml-simple",[">= 0"]],["formatador",[">= 0.2","< 2.0"]],["excon",["~> 0.71"]],["mime-types-data",["~> 3.2015"]],["mime-types",[">= 0"]],["builder",[">= 0"]],["fog-core",["~> 2"]],["json",[">= 0"]],["ruby-libvirt",[">= 0.7.0"]],["fog-xml",["~> 0.1.1"]],["multi_json",["~> 1.10"]],["fog-json",[">= 0"]],["fog-libvirt",[">= 0.6.0"]],["vagrant-libvirt",["= 0.10.8"]]],"checksum":"ef6f5565e93f365a74a7a0dd9d3f0f586bd6da21d2ea8fa1b869a56b45642348","vagrant_version":"2.3.4"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:a4dadb58-747c-44bf-87f5-ac311394a86f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1673857774
1 change: 1 addition & 0 deletions setup/kubeadm/.vagrant/machines/master/virtualbox/box_meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"bento/ubuntu-22.04","version":"202206.13.0","provider":"virtualbox","directory":"boxes/bento-VAGRANTSLASH-ubuntu-22.04/202206.13.0/virtualbox"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1001
1 change: 1 addition & 0 deletions setup/kubeadm/.vagrant/machines/master/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a4dadb58-747c-44bf-87f5-ac311394a86f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f5d1b9022a68492a8d58011b8b9bc847
27 changes: 27 additions & 0 deletions setup/kubeadm/.vagrant/machines/master/virtualbox/private_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAmEY+/z6JC0nPJBoXcc3N8wQpN3HgM2FZimVLTRFSFBLcBhc3
xbgPfspuXey01tC9bk6SFqEpz/riG6a+vjm8uSX79mFaVO3xWMOAhf7qNN45j8Fu
mfxycH/LPbM9X8DWmG38E/NSi23sqmHlHg+sqsjURwN7LRKk5FxLJEY8b0LbrjDN
MKi9jvWI02Z27Fm1uoHxj0IiPoB9ziDWcckS9+0jiExge5onJeSPHc/DfjK0jHu1
FiJk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l/ERRuvVaw55
jBrh02zhI2EKOnY/hkbE3Ihrm47lzB17vVBqkMDAK5zcr7CDgfClKOsmsYhn6Yb6
TbALMOECgYEArenvgu4r2sbvjaY7KusmK9+lp7BetFW3Pf1/SI8/2MIgpY0FmVIg
1rM6VODVVqUFVvteOx+fYV3/AArDXauCGj+l6Z4Nt/3pHAeXBXLVKBvW/y/Kj3J6
SHA68pV/iDIuuhMjg58wGyXpsOskJ1AfzuyXFVM2dEhyrDHDi+GsznY=
-----END RSA PRIVATE KEY-----
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"virtualbox":{"/vagrant":{"guestpath":"/vagrant","hostpath":"/home/rajesh/git/brainupgrade-in/kubernetes/setup/kubeadm","disabled":false,"__vagrantfile":true}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/rajesh/git/brainupgrade-in/kubernetes/setup/kubeadm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:bd5bbc96-8e3b-456e-a4a9-71adc5ca9122
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1673858084
1 change: 1 addition & 0 deletions setup/kubeadm/.vagrant/machines/node01/virtualbox/box_meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"bento/ubuntu-22.04","version":"202206.13.0","provider":"virtualbox","directory":"boxes/bento-VAGRANTSLASH-ubuntu-22.04/202206.13.0/virtualbox"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1001
1 change: 1 addition & 0 deletions setup/kubeadm/.vagrant/machines/node01/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bd5bbc96-8e3b-456e-a4a9-71adc5ca9122
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11fecf73722945d5920b39bde00c8a54
27 changes: 27 additions & 0 deletions setup/kubeadm/.vagrant/machines/node01/virtualbox/private_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAx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XMCgYAYEorHJceUCm2cgX+keSsY
LTjS2oplLJMdyJ2Qa5B9mWgTTusVi6B578txVNupVW1XU4t6BpPR/RCOBiSBefUX
KqbFi1nQdo5iByIWzKCI+VUUYtjv8/At0Il8X+hyrpmVnPlJFvAzAf5/XAegJLwS
N1zpGSIW+L0mEr/j6iCXFQKBgQCSeE6nLLIt0dmujRA75qfGNqjJX9r4GqitBG7i
0tQXBSKsojaHXMLmvT/7lAAlisfDeHWIbLDFxMVJjIbUB9ZPr65GJPFtDdWgJ3Z1
R4552Y33K5ZYymlrjTcXvn29rK0d5ROzTNCsoilhXPrQ4j1T/yVxoMwJ3FDMIfRV
15nAxQKBgQDDDsgo7Ic/uecBt3/7rA6tdGW+FPLYID6C6qalFyxS27y9xS32PN0w
hsHnCX8yMv2FgxJsXcvGN6mI/4Bfg7YfHLsyxjkQKPFwO6Evjbk5hd9PNcbBI0Hp
GIuREoJdqJ52fHa+JyETUMD9VFkpDW+Oh7NrAgT6bAKJ7zt/JF0+hw==
-----END RSA PRIVATE KEY-----
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"virtualbox":{"/vagrant":{"guestpath":"/vagrant","hostpath":"/home/rajesh/git/brainupgrade-in/kubernetes/setup/kubeadm","disabled":false,"__vagrantfile":true}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/rajesh/git/brainupgrade-in/kubernetes/setup/kubeadm
9 changes: 9 additions & 0 deletions setup/kubeadm/.vagrant/rgloader/loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.

if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
39 changes: 39 additions & 0 deletions setup/kubeadm/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
NUM_WORKER_NODES=2
IP_NW="10.0.0."
IP_START=10

Vagrant.configure("2") do |config|
config.vm.provision "shell", env: {"IP_NW" => IP_NW, "IP_START" => IP_START}, inline: <<-SHELL
apt-get update -y
echo "$IP_NW$((IP_START)) master-node" >> /etc/hosts
echo "$IP_NW$((IP_START+1)) worker-node01" >> /etc/hosts
echo "$IP_NW$((IP_START+2)) worker-node02" >> /etc/hosts
SHELL

config.vm.box = "bento/ubuntu-22.04"
config.vm.box_check_update = true

config.vm.define "master" do |master|
master.vm.hostname = "master-node"
master.vm.network "private_network", ip: IP_NW + "#{IP_START}"
master.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 2
end
master.vm.provision "shell", path: "common.sh"
end

(1..NUM_WORKER_NODES).each do |i|

config.vm.define "node0#{i}" do |node|
node.vm.hostname = "worker-node0#{i}"
node.vm.network "private_network", ip: IP_NW + "#{IP_START + i}"
node.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 1
end
node.vm.provision "shell", path: "common.sh"
end

end
end
65 changes: 65 additions & 0 deletions setup/kubeadm/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

KUBERNETES_VERSION="1.25.0-00"
OS="xUbuntu_22.04"
# CRI-O version
VERSION="1.25"

set -euxo pipefail
# disable swap
sudo swapoff -a

(crontab -l 2>/dev/null; echo "@reboot /sbin/swapoff -a") | crontab - || true

sudo apt-get update -y

# Create the .conf file to load the modules at bootup
cat <<EOF | sudo tee /etc/modules-load.d/crio.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter

# Set up required sysctl params, these persist across reboots.
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

sudo sysctl --system

cat <<EOF | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /
EOF
cat <<EOF | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.list
deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /
EOF

curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/libcontainers.gpg add -

sudo apt-get update
sudo apt-get install cri-o cri-o-runc -y

sudo systemctl daemon-reload
sudo systemctl enable crio --now

echo "CRI runtime installed susccessfully"

sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update -y
sudo apt-get install -y kubelet="$KUBERNETES_VERSION" kubectl="$KUBERNETES_VERSION" kubeadm="$KUBERNETES_VERSION"
sudo apt-get update -y
sudo apt-get install -y jq

local_ip="$(ip --json a s | jq -r '.[] | if .ifname == "eth1" then .addr_info[] | if .family == "inet" then .local else empty end else empty end')"
cat > /etc/default/kubelet << EOF
KUBELET_EXTRA_ARGS=--node-ip=$local_ip
EOF
47 changes: 47 additions & 0 deletions setup/kubeadm/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Steps to launch kubeadm cluster (1 master, 2 worker nodes)
- Install Vagrant (https://developer.hashicorp.com/vagrant/downloads)
- Copy Vagrantfile and common.sh from this folder to your computer say /home/kubernetes/kubeadm
- Open terminal say Tab1 and `cd` where you copied above files and Run `vagrant up`
- ssh into master `vagrant ssh master`
- Launch cluster by initializing master node
`kubeadm init --apiserver-advertise-address 10.0.0.10 --pod-network-cidr 192.168.0.1/16`
- Install CNI `curl https://docs.projectcalico.org/manifests/calico.yaml -O && kubectl apply -f calico.yaml`
- Get join command using this command on master `kubeadm token create --print-join-command`
- Launch one more terminal tab say Tab2 & copy join command and ssh into node01 `vagrant ssh node01`
- Paste the join command & hit Enter

# Enable ingress & Test
- Install ingress from nginx `kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/baremetal/deploy.yaml`
- Deploy hello app `kubectl create deploy hello --image brainupgrade/hello`
- Expose the app as service `kubectl expose deploy hello --port 80 --target-port 8080`
- Create ingress for this app `kubectl create ingress hello --rule="hello.brainupgrade.in/*=hello:80" --class nginx`
- Add this line `10.0.0.10 hello.brainupgrade.in` to your /etc/hosts file on your host computer
- Install nginx using `sudo apt install nginx` and then create conf `sudo vi /etc/nginx/sites-available/kubernetes.conf` with below content
```
upstream kubernetes {
server 10.0.0.10:<nginx ingress svc port mapped for 80>;
}
server {
listen 80;
server_name hello.brainupgrade.in;
location / {
proxy_http_version 1.1;
proxy_connect_timeout 60s;
proxy_read_timeout 60s;
proxy_send_timeout 60s;
client_max_body_size 1m;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering on;
proxy_pass http://kubernetes;
}
}
```
- Enable the app URL `sudo ln -s /etc/nginx/sites-available/kubernetes.conf /etc/nginx/sites-enabled/`
- Restart / reload nginx `sudo systemctl restart nginx`
- kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/baremetal/deploy.yaml
2 changes: 2 additions & 0 deletions setup/minikube/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Setup minikube cluster using vagrant & virtualbox
- Run vagrant init

0 comments on commit a200ea4

Please sign in to comment.