Setup Kubernetes Cluster on OpenPower Servers using Kubeadm

This a short guide describing how to use kubeadm tool to setup a Kubernetes cluster on OpenPower servers.

Kubeadm is a tool which helps to setup a Kubernetes cluster using just two commands – kubeadm init and kubeadm join.

More details on kubeadm is available from the following link – https://kubernetes.io/docs/admin/kubeadm/

Kubeadm is supported for multiple architectures and binary packages for Power servers (ppc64le architecture) are now available from the community repos.

This is a short guide to get you started with kubeadm on Power servers running Ubuntu 16.04

Install Docker

Configure repo and install docker on all the nodes that are going to be part of the Kubernetes cluster.

# apt-get update
    apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

# add-apt-repository \
   "deb https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
   $(lsb_release -cs) \
   stable"

# apt-get update && apt-get install -y docker-ce

Install Kubeadm

Configure repo and install kubeadm and related packages on all the nodes.

# apt-get update && apt-get install -y apt-transport-https

# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

# cat </etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF

# apt-get update

# apt-get install -y kubelet kubeadm kubectl

Setup Kubernetes using Kubeadm

1. Setup Master

On the node designated as master run the following command:

# kubeadm init
kubeadm init
[init] Using Kubernetes version: v1.9.3
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks.
[snip]

Your Kubernetes master has initialized successfully!

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 --token 3357c1.67dae14e3198e794 192.168.122.246:6443 --discovery-token-ca-cert-hash sha256:e63df765d554744a740566af0a87572149c05678134874283542f6043288774a

192.168.122.246 is the IP of the master server where ‘kubeadm init’ is executed.
If you are installing on a system with multiple IP addresses, then you might want to use the –apiserver-advertise-address option to specify a particular IP address for the kubernetes apiserver.

2. Configure kubectl on the master node

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

3. Configure Container Networking
Perform the following steps on the master node to setup container networking.

$ export kubever=$(kubectl version | base64 | tr -d '\n')
$ kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever"

This will setup weave networking for containers.

Setup Worker Nodes
On all the worker nodes, run the following command:

# kubeadm join --token 3357c1.67dae14e3198e794 192.168.122.246:6443 --discovery-token-ca-cert-hash sha256:e63df765d554744a740566af0a87572149c05678134874283542f6043288774a

[snip]
This node has joined the cluster:
* Certificate signing request was sent to master and a response
  was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the master to see this node join the cluster.

You should now have a working Kubernetes cluster on Power servers.

If you are currently looking for a production deployment of Kubernetes on Power servers, please have a look at IBM Cloud Private.

Pradipta Kumar Banerjee

I'm a Cloud and Linux/ OpenSource enthusiast, with 16 years of industry experience at IBM. You can find more details about me here - Linkedin

You may also like...