Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Setup Kubernetes on Ubuntu 16.04

$ sudo apt-get update
$ sudo apt-get install -y apt-transport-https
$ sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ sudo echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
$ sudo apt-get update -y
$ sudo apt install docker.io
$ sudo apt-get install -y kubelet kubeadm kubernetes-cni
$ cat /proc/swaps
$ swapoff
$ kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=
$ sudo useradd kube -G sudo -m
$ sudo passwd kube
$ sudo su - kube
$ sudo cp /etc/kubernetes/admin.conf $HOME/
$ sudo chown $(id -u):$(id -g) $HOME/admin.conf
$ export KUBECONFIG=$HOME/admin.conf
$ echo "export KUBECONFIG=$HOME/admin.conf" | tee -a ~/.bashrc

Check pods status, wait until all running

$ su - kube -c kubectl get pods --all-namespaces
$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml

# or

$ kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml
$ kubectl taint nodes --all node-role.kubernetes.io/master-
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

Create dashboard user

create-user.yml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system

create-role.yml

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kube-system
$ kubectl create -f create-user.yml
$ kubectl create -f create-role.yml
$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

References :

  • https://github.com/kubernetes/dashboard/wiki/Creating-sample-user
  • https://github.com/kubernetes/dashboard/wiki/Accessing-Dashboard—1.7.X-and-above

The post Setup Kubernetes on Ubuntu 16.04 appeared first on Python in the jungle.



This post first appeared on Pulpn - Cool News Directories, please read the originial post: here

Share the post

Setup Kubernetes on Ubuntu 16.04

×

Subscribe to Pulpn - Cool News Directories

Get updates delivered right to your inbox!

Thank you for your subscription

×