Sitemap

Kubernetes Basics

1 min readFeb 20, 2019

--

Open https://labs.play-with-k8s.com/ to access Kubernetes Playground.

This is a sandbox environment. Using personal credentials
is HIGHLY! discouraged. Any consequences of doing so, are
completely the user’s responsibilites.

You can bootstrap a cluster as follows:

1. Initializes cluster master node:

kubeadm init — apiserver-advertise-address $(hostname -i)

2. Initialize cluster networking:

kubectl apply -n kube-system -f \
https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 |tr -d ‘\n’)”

3. (Optional) Create an nginx deployment:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/nginx-app.yaml

4. To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

You should now deploy a pod network to the cluster.
Run “kubectl apply -f [podnetwork].yaml” with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of machines by running the following on each node
as root:

kubeadm join 192.168.0.13:6443 — token k09a5c.v5sa9z9vujgh737k — discovery-token-ca-cert-hash sha256:e3c602d871bfce853d7ebfe84b355f07135391580711ec5501ee49e89c688fdb

NOTE: joining node command will be with respect to your master

--

--

Jinna Baalu
Jinna Baalu

Written by Jinna Baalu

Devops Solution Architect | Managing Consensus based Distributed Clusters | Centralised Logging 4M/15min | ELK | Prometheus | Kafka | Cassandra | Mongo