





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.
- Use a Cloud provider, like AWS, GCP, etc… to bring up you cluster
- Use minikube to quickly test the Kubernetes capability
- Use a full blown installation (in 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/proxyTip: 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.10Now, 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" createdNext, lets expose the application, you do so by running the below.
kubectl expose deployment hello-minikube --type=NodePort service "hello-minikube" exposedYou 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-hostOption 3 Use VNC server to connect and manage the cluster with the dashboard On the Kubernetes master, run
vncserver -geometry 1880x980 :0Then just connect with your favorite vnc viewer on port 5900 Once done, just run
vncserver -kill :0You 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 belowminikube stopSummery: 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