Thursday, March 16, 2017

Kubernetes Dashboard on VMware PhotonOS

What is Kubernetes Dashboard


Kubernetes Dashboard is a general purpose, web-based UI for Kubernetes clusters. It allows users to manage applications running in the cluster and troubleshoot them, as well as manage the cluster itself.

You can use Dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster itself along with its attendant resources. You can use Dashboard to get an overview of applications running on your cluster, as well as for creating or modifying individual Kubernetes resources (such as Deployments, Jobs, DaemonSets, etc)

Pre-requisites


  • Working Kubernetes Cluster ( Please refer my previous post (here) if required )
  • Internet Access on the VM/Docker Host where you are deploying the dashboard
  • In my case I will be deploying it on Master VM


Deployment


As per the documentation it pretty straight forward. Execute following command and if its meets all the checks it will download and install the dashboard

$ kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml

However


If you try to install it on Photon OS it will not be able to download the Container and it will fail
It successfully create deployment and service





It will create POD however you will see the Status as ImagePullBackoff



Based on my limited understanding and analysis , this is due to the way it schedules and looks up the “apiserver”.
In my case it was scheduling on worker nodes and it was trying to lookup using localhost hence it was failing to download the container

Work Around


You will have to create local yaml file and Uncomment the line and specify   --apiserver-host=http://my-address:port


$ kubectl create –f kubedashboard.yaml


Now you check the POD it will say status as Running


You can also validate Service and Deployment


Following are the docker containers it deploys







Now you should be able to access the dashboard http://masterip:8080/ui



References



  • https://kubernetes.io/docs/user-guide/ui/
  • https://github.com/kubernetes/dashboard


Tuesday, March 14, 2017

Kubernetes Installation & Configuration on VMware Photon OS

What is Kubernetes

Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container-centric infrastructure.
With Kubernetes, you are able to:
  • Deploy your applications quickly and predictably.
  • Scale your applications on the fly.
  • Seamlessly roll out new features.
  • Optimize use of your hardware by using only the resources you need.

For more information Click Here

Pre-requisites

  • 2/3 VMware PhotonOS VM with docker enabled and configured as per my earlier post – Click Here
  • For Lab setup please allow everything in firewall using following commands
iptables -I INPUT -j ACCEPT
  • Internet Connection on all 3 VMs

My Environment Setup

I have 3 VMs
  • 1 – Photon Master (hostname – photon-os)
  • 2 – Worker or Minion Nodes (hostname(s) – photon-node, photon-node01)

Installation of Kubernetes

Execute following command on all 3 nodes. You can also use –y switch to accept by default
tdnf install kubernetes


Size of the package is about 500MB so it will take time depending upon Internet Speed. I haven’t tried offline method

Configuration


Modify /etc/hosts  on all hosts


Add master and node to /etc/hosts on all machines (not needed if the hostnames are already in DNS). Make sure that communication works between photon-master and photon-node by using a utility such as ping


Modify Kubernetes Config on all hosts


Edit /etc/kubernetes/config on all machines as per following
Before

After

Configure Kubernetes on Master

Edit /etc/kubernetes/apiserver as per following

Before
After

Start Kubernetes Services on Master


I will be enabling following services on master as I want Master to be worker/minion node as well
  • etcd
  • kube-apiserver
  • kube-controller-manager
  • kube-scheduler
  • kube-proxy
  • kubelet

If you don’t require master to be worker/minion node then don’t include following 2 service
  • kube-proxy
  • kubelet


for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler kube-proxy kubelet; do
    systemctl restart $SERVICES
    systemctl enable $SERVICES
    systemctl status $SERVICES
done


In case you run into issues with kube-apiserver you will need to reboot the VM

Create node.json for worker/minion nodes



Create Node objects


Make a node object internally in your Kubernetes cluster by running the following command


Verify Node objects



Status will show Unknown and its normal behavior as we have not done any configuration on worker/minion node

Configure Kubernetes  on Worker/Minion Node


Modify Kubelet Config

Edit /etc/kubernetes/kubelet as per following
Before
After

Enable and Start Services



Verify Nodes on Master



Verify Kubernetes Setup on Master


In the next blog post I will be configuring Kubernetes Dashboard on PhotonOS

Thursday, March 9, 2017

Update Docker on VMware Photon OS using Tdnf

In my previous article (here) I presented how to install Photon OS. Docker installed as part of the ISO was version 1.11 however the latest available on Photon OS is 1.12.6

This blog post is to demonstrate the upgrade procedure using Tdnf

What is Tdnf


It is abbreviation for Tiny Dandified Yum. It is the default package manager on Photon OS.

Tdnf appears in the minimal and full versions of Photon OS. Tdnf reads yum repositories and works like yum.

The full version of Photon OS also includes yum, and you can install packages by using yum if you want

Click Here for more details

Procedure


Check Current Version of Docker


Check the version of docker available to upgrade


Upgrade Docker using following command


Check the Version


Reload and Restart docker daemon to complete update




Tuesday, March 7, 2017

VMware Photon OS Installation & Configuration

What is Photon OS


Photon OS is a minimal Linux container host designed to have a small footprint and tuned for VMware platforms. 
It offers following benefits

  • Optimized for vSphere - Validated on and tuned for VMware product and provider platforms.
  • Container support - Supports Docker, rkt, and the Pivotal Garden container specifications.
  • Efficient lifecycle management - contains a new, open-source, yum-compatible package manager that will help make the system as small as possible, but preserve the robust yum package management capabilities.

Photon OS is available in a few different pre-packaged, binary formats:

  • ISO Image
  • OVA
  • Amazon AMI
  • Google GCE Image

Installation


I will be demonstrating installation of Photon via ISO Image

Download ISO from here and upload it to the appropriate datastore
Create a VM for Photon OS host and boot from the ISO


This were you can choose the Type of Install. I will be choosing Minimal Install. If you require you can try with full.

Caution - If you decide to use full please ensure you have appropriate space on the datastores


It took about 38 secs to install and when you reboot it will take hardly less than 5 seconds to boot up. If you have DHCP enabled this will be end of setup

If you would like to use static IP please refer to perform static IP configuration  - Click Here


Configuration


We will be doing some initial configuration to get you going

Enable SSH


By default Photon does not permit root login to SSH.

To make yourself login as root using SSH set PermitRootLogin yes in /etc/ssh/sshd_config, and restart the sshd deamon.


Enable Docker


By default docker is preinstalled in Photon. Cool isn’t it J . You just have to enable it

You can enable and start docker using following commands

systemctl status docker
systemctl enable docker
systemctl start docker


Please refer my article on “Basic Docker CLI Commands”- http://bit.ly/2lo6FUC

I have given you couple of screenshots here


Enable Remote API on PhotonOS


Click Here for the original article. I will be walking through the steps involved

First stop docker  - systemctl stop docker

Create the config file  with following - vi /etc/default/docker

DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"

Allow port from firewall - iptables -A INPUT -p tcp --dport 2375 -j ACCEPT

Start docker - systemctl start docker

Check Status – systemctl status docker


Configure VMware Admiral


If you are not sure what Admiral please refer my article on the same – Click Here

Run VMware Admiral docker container

docker run -d -p 8282:8282 --name admiral vmware/admiral



Browse to the URL



Add a Host and starting managing it from UI if you would like instead of CLI


References


https://vmware.github.io/photon/
https://github.com/vmware/photon