DevTech101

DevTech101
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 1.00 out of 5)
Loading...

Kubernetes Cluster installation, configuration on Ubuntu 17.04

Below I am going to demonstrate options available to manage a Kubernetes Cluster in your own private cloud. First of, What is Kubernetes? Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery. Note: It is necessary to have prior experience using Docker before working with Kubernetes. It should also be noted that the Kubernetes system is available on multiple Cloud providers. To quickly test drive the Kubernetes system, you have multiple options.
  1. Use a Cloud provider, like AWS, GCP, etc… to bring up you cluster
  2. Use minikube to quickly test the Kubernetes capability
  3. Use a full blown installation (in a small scale)
Below I will start by using option 2, I will then move on to option 3 with a full blown setup (of-curse on a small scale) .

Installing minikube

Getting minikube to work on Ubuntu is a straight forward, simple process. Lets start by downloading minikube.
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod
 +x minikube && sudo mv minikube /usr/local/bin/
While at it lets also download the kubectl utility.
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.go
ogleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/
Lets make sure minikube works
minikube version
minikube version: v0.20.0

Running minikube

Now, lets start the minikube cluster. Tip: minikube is meant to be run on a single physical node, therefore, bringing up the cluster is extremely simple.
minikube start --docker-env HTTP_PROXY=http://your-proxy-ip:8080 --docker-env HTTPS_PROXY=https://your-proxy-ip:8080
Starting local Kubernetes v1.6.4 cluster...
Starting VM...
Downloading Minikube ISO
 90.95 MB / 90.95 MB [==============================================] 100.00% 0s
Moving files into cluster...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster.
Note: You can omit the proxy options, if you are not working behind a proxy. The cluster should now be up and running, lets verify by running.
kubectl cluster-info
Kubernetes master is running at https://10.10.10.10:6443
KubeDNS is running at https://10.10.10.10:6443/api/v1/namespaces/kube-system/services/kube-dns/proxy
Tip: For a full cluster dump run kubectl cluster-info dump Note: If you are behind a proxy, before continuing the below, Make sure to add your cluster ip i.e. 10.10.10.10 to your no_proxy list. For example:
export no_proxy=kub,kub.domain.com,127.0.0.0/8,127.0.1.1,127.0.1.1*,10.10.10.10
Now, Lets bring up the hello application by running the below.
kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
deployment "hello-minikube" created
Next, lets expose the application, you do so by running the below.
 
kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed
You can test the application by running the below.
curl $(minikube service hello-minikube --url)
CLIENT VALUES:
client_address=10.10.10.10
command=GET
real path=/
...
To find out the the minikube dashboard url/ip, just run the below.
minikube dashboard --url

Tip: Normally, you will only be able to connect to the dashboard from 127.0.0.1 i.e. the local host.

To expose the port for external access, you have two options Option 1 Run kubectl proxy, make sure to add the below option.
kubectl proxy --address 0.0.0.0 --port=7070 --accept-hosts '.*'
Now in browser, the below should work. Note: The above commend opens widely the full cluster management, which is extremely un-secure.
http://10.10.10.10:7070/ui

# Or the full api
http://10.10.10.10:7070/
Option 2
ssh -R 9000:localhost:8001 root@kubernetes-host
Option 3 Use VNC server to connect and manage the cluster with the dashboard On the Kubernetes master, run
vncserver -geometry 1880x980 :0
Then just connect with your favorite vnc viewer on port 5900 Once done, just run
vncserver -kill :0
You now have a small Kubernetes cluster to test with. Kubernetes minikube – Helpful tips
# List all services
kubectl get services --all-namespaces

# Get minikube Cluster IPRange
minikube logs | grep ServiceClusterIPRange

# Get status of all pods
kubectl get pods --all-namespaces

Clean up – Destroy the minikube with all pods and services

To remove all services and pods, just run the below
minikube stop
Summery: In this post I went over the basics, getting your fingers wet by using minikube to manage your Kubernetes cluster. In the next post, I am going to dive in deeper, installing and configuring your own Kubernetes cluster by using kubelet and kubeadm. You might also like: Master Index – Related Posts To Docker, Kubernetes And Micro-Services. Whats tools are you using to manage your Kubernetes Cluster? please let me know in the comments below.
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
%d bloggers like this: