Kubernetes and vMotion: what happens?

VMware 7.0 with kubernetes has been deployed.

Someone asked me what happens during a ESX vMotion? Does the pod migrate? not quite. While it will spin up a new pod on a different node, that’s not a vMotion. If you want that data to be persistent, make sure your application has a persistent volume claim.

Create a namespace

Give it a name


ReadMe


Add permissions, with Edit Role. I previously created a user account name demouser.



Add storage policy, typically vSAN Default Storage Policy. Other policy profiles can be defined as well thru vCenter VM Storage Policies menu.




From here, we can set any Capacity and Usage limits.


Let’s get logged kubernetes by following the “Link to CLI Tools” by either selecting the “Copy link” or “Open” to watch the installer for your client system to which you will connect from. I stood up a basic linux system for such purpose.

Open the link and review details.




Change dropdown from Windows to Linux or Mac OS

let’s get the plugin. There’s a nice how to there on that page when selecting CLI Plugin Linux.

I like to make a kubectl alias link to letter ‘k’. $ln -s kubectl k


Go to kubernetes.io and get a copy of the wordpress using persistent volume in mysql https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/

The long and short of it is make a directory and put the files in the directory.

After going thru the tutorial, I created my first github repo so I can redeploy a little easier. \n

located at: https://github.com/batx123/wordpress

$git clone https://github.com/batx123/wordpress.git

Connect to kubernetes

kubectl vsphere login –server 172.28.76.1 –vsphere-username administrator@vsphere.local –insecure-skip-tls-verify


change context to wordpress namespace

kick off the deployment using kubernetes command: $k apply -k ./


We ran get pods to ensure pods are in a READY STATE and also got the front-end IP

fill out the form to get wordpress initial config up.


Go ahead and do stuff to make it unique if you like, like a hello world page or something.


OK. Where is our data? Where is the the process running?

When we ran the kubernetes apply command, it created two persistent volume claims.

A different way of looking at same information is by selecting Hosts and Clusters > Monitor > Cloud Native Storage > Container Volumes.


Switch back to the linux cli and run the following command: \n

[ben@cent1 wordpress]$ k describe pod wordpress

The output is excellent source for reviewing pod details. We can see the pod is running on node: esx-08a.




Notice the image pull and successfully attached the persistent volume claim (pvc).

The Events section is telling us if things are working or if there was an issue in downloading image or attaching the newly created volume.


There are also Kubernetes and vCenter events in vCenter GUI by selecting the pod name under hosts and clusters > Monitor > Events



I am going to place host esx-08a in maintenance mode and rerun the describe command.

wordpress terminated the old pod on esx-08a, and it’s spinning up a new pod.


let’s run the kubectl describe pod command again, but this time, choose the updated pod name, the numbers and letters appended to the pod will be different.



Host esx-08a is still in maintenance mode. The following command shows more info on this node.


Let’s take host esx-08a out of mainenance mode


Let’s check on our website to see if it’s still configured and had my stuff. It does. My Hello World is still there. Edited page to add “In order for this to work, there must be a persistent volume claim.”

Published by Ben

I do stuff in the datacenter.

Leave a comment

Your email address will not be published. Required fields are marked *