Using Kubernetes Cluster For Your Private Cloud Orchestration – Part 2

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Kubernetes Cluster installation, configuration on Ubuntu 17.04

This is the second post of this series, how to install and configure your own Kubernetes cluster. in part one I went over configuring a Kubernetes cluster by using minikube – a simplified process, in this post I moving to the next step – installing, configuring by using kubeadm and kubelet.

First lets make sure we have the latest OS(Ubuntu) bits.

Now we are ready to start with the kubernetes installation.
Lets add / configure the kubernetes repo.

Now, lets install the kubernetes application binary.

Note: I wasn’t able to use the stock kubernetes installation, due to a bug with version 1.7.1 which is part of the Ubuntu 17.04 repo. more details are outlined below. to manual install the latest version just follow these steps – Installing Minikube – Kubectl

Initializing kubernetes

To Initialize kubernetes you can just run kubeadm with the init option. something like the below.

Now depending on what driver/options(CNI or CNM) you are using for your Docker networking, might/will require more specific options, more below.

There are many network options to choose from in a Docker/kubernetes installation. below I will describe some of these options.

  1. Flannel only
  2. Calico only with Calico Policy
  3. Flannel with Calico Policy
  4. Weave Net (Not discussed below)
  5. Cilium (Not discussed below)
  6. Contrail, based on OpenContrail (Not discussed below)

Note: To specify a specific ip/interface to listen-on add the fowling options to the init process.

Using the flannel driver

If you are planning on using the flannel driver, make sure to add the –pod-network-cidr option.
Your output will look something like below.

To be able to manipulate and connect locally to the cluster, run the below (or copy to other node).

In my case I working on only one physical node, in order to continue with the rest of the steps the below role change is required.

Note: By default, your cluster will not schedule pods on the master for security reasons. If you want to be able to schedule pods on the master, e.g. for a single-machine Kubernetes cluster for development, you will have the to run the above.

Next, you have to decide which network driver you are going to use.
Below I will first show you how to use the flannel driver. I will then destroy the configuration and to re-do with the calico driver.

Flannel driver configuration

Lets jump right in.
First we need to get the Flannel yaml configuration files.
Tip You can specify the Flannel yaml web url directly if you have Internet access.

For Flannel we also need the RBAC policy file.
To use / apply the flannel driver just run the below (or specify a local yml file if you don’t have web access).

Current pods with Flannel network and policy engine.

Next verify if the node is ready to join the cluster, by running the below.

You are now ready to join the cluster.
Note: This would normally run on the nodes (not the master as in my case).

Note: In Kubernetes stock(version 1.7.1) on Ubuntu 17.04 there is a bug by trying to join the cluster you will get something like to error below.

For the time being, you have the below two options:

  1. Add –skip-preflight-checks to the join options
  2. Upgrade / Install the binary from Goggle directly as outlined in part 1 – Installing Minikube / Kubectl

Installing / adding the kubernetes dashboard (optionally).

To access the dashboard, just run the below

Now go to http://localhost:8001/ui to access the dashboard.

To find what your kubernetes-dashboard ip is, run the below.

Tip: Your dashboard will normally only be available from withing your cluster, to see how to get around this click here – kubectl proxy options

I created a quick simple script to bring up a fresh cluster, the script can be find at the end of this post.

Cluster tear down (Flannel)- Remove all nodes / pods

To play with the Calico network driver, I am going to tear down the cluster, then re-create with the Calico network driver.

The simple steps below should do it.

kubernetes using the Calico network driver

First lets initialize / re-create the cluster (same steps above).
For complete output check above at the Flenel configuration, as the steps are the same I am not going to repeat.

Now, we need to install / apply the calico driver.

Thats it, after a few minutes, your cluster is ready to be used.
You will need to join the node to the cluster same as above.
Optional, you can add the dashboard – same as above.

Your current pods with Calico network and policy engine.

Cluster tear down (Calico) – Remove all nodes / pods

To tear down the cluster just run the below.

Common helpful tips in your Kubernetes cluster

Get logs flannel, calico

List all nodes

List all pod namespaces

Delete all pods in one namespace

To list all deployments

To list all services

List config contexts

Kubectl Cheatsheet/

Other helpful tips

Controlling your cluster from machines other than the master

Installing a sample application from Goggle

Goggle has a sample application that can be used to test/play with kubernetes.

Get front-end service ip.

Get pod info for the sock-shop applaication

Appendix – Kubernetes Script

Flannel script

Calico script

Compile kubernetes your self

You might also like:
Master Index – Related Posts To Docker, Kubernetes And Micro-Services.

Whats tools/scripts are you using to manage your Kubernetes Cluster? please let me know in the comments below.

Leave a Reply

avatar
  Subscribe  
Notify of