Giter VIP home page Giter VIP logo

kubernetik's Introduction

Kubernetes Cluster Setup

(single control-plane cluster)

Install kubeadm (all nodes)

user@master:~$ sudo apt-get update && sudo apt-get install -y apt-transport-https curl
user@master:~$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
user@master:~$ cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
user@master:~$ sudo apt-get update
user@master:~$ sudo apt-get install -y kubelet kubeadm kubectl
user@master:~$ sudo apt-mark hold kubelet kubeadm kubectl

Install docker (all nodes)

user@master:~$ sudo apt install -y docker.io

Enable cgroups

user@master:~$ sudo docker info
user@master:~$ sudo vim /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}

For the Raspberry Pi 4

DO NOT FORGET TO REBOOT SYSTEM AFTER CHANGING CMDLINE.TXT

Enable following options

  • cgroup_enable=cpuset
  • cgroup_enable=memory
  • cgroup_memory=1
  • swapaccount=1
user@master:~$ sudo sed -i '$ s/$/ cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 swapaccount=1/' /boot/firmware/cmdline.txt

Initialise master node

user@master:~$ sudo kubeadm init --pod-network-cidr=192.168.0.0/16
user@master:~$ mkdir -p $HOME/.kube
user@master:~$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
user@master:~$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

Install Calico (master only)

user@master:~$ kubectl apply -f https://docs.projectcalico.org/v3.11/manifests/calico.yaml

Join master node

user@master:~$ sudo kubeadm token list  # use this token
user@master:~$ openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | \ # get hash
   openssl dgst -sha256 -hex | sed 's/^.* //'
   
user@slave:~$ sudo kubeadm join {{MASTER_IP}}:6443 --token {{TOKEN}} \
    --discovery-token-ca-cert-hash sha256:{{HASH}}s

Kubernetes cluster is up and running ๐Ÿ‘‘

Alt Text

Configure kubectl on slave nodes

user@slave:~$ mkdir -p $HOME/.kube
user@slave:~$ scp user@{MASTER_IP}:/home/user/.kube/config .kube/config
user@slave:~$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

Install Web UI

Alt Text

I suggest using Octane, because default Kubernetes Dashboard is a bit hard to configure correctly

user@master:~$ wget https://github.com/vmware-tanzu/octant/releases/download/v0.12.1/octant_0.12.1_Linux-64bit.deb
user@master:~$ dpkg -i octant_0.12.1_Linux-64bit.deb

Use OCTANT_LISTENER_ADDR=0.0.0.0:7777 to allow connections from any host

OCTANT_LISTENER_ADDR=0.0.0.0:7777 octant

If you are in production, set OCTANT_ACCEPTED_HOSTS to the value of the host you are trying to connect to Octant from, and OCTANT_LISTENER_ADDR to host IP

OCTANT_ACCEPTED_HOSTS={EXTERNAL_IP} OCTANT_LISTENER_ADDR={SERVER_IP}:80 octant

Install Helm

user@master:~$ cd /tmp
user@master:~$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3

user@master:~$ chmod u+x get_helm-helm.sh
user@master:~$ ./get_helm.sh
user@master:~$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/
user@master:~$ helm repo update

kubernetik's People

Contributors

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