Category Archives: HOME

Introduction to vSphere with Kubernetes REST APIs

vSphere 7.0 is now generally available and without a doubt “vSphere with Kubernetes” (former project pacific) is biggest highlights of the release. I think, this will have similar or even bigger impact on IT landscape since the launch of ESXi or vMotion in the past. Coolest thing is that VMs and containers can co-exist and no tools to manage them are changing. I am personally very happy that vSphere is now just not about VMs but also containers (read “vThinkBeyondVM”) as well.

Note: As you already might know “vSphere with K8s” is available through VMware Cloud Foundation(VCF). I highly recommended you to read this quick post on how to get “vSphere with Kubernetes”? Post is written by none other than Kit Colbert . Very straight and simplified post if you ask me. Also, here is the official documentation on “vSphere with K8s” for your further learning

As usual I enjoy exploring new APIs got introduced as part of new vSphere release. As I run through vCenter API explorer (H5C -> Menu -> Devloper center -> API Explorer), I see this release has more REST APIs compared to SOAP APIs unlike any earlier vSphere releases. In this post, I will introduce you to new APIs got exposed as part of vSphere with Kubernetes (K8s). I am pleased to see that 100% of the APIs to manage vSphere with K8s are REST based. How cool is that !

First things to note that “API-endpoint” to call these APIs is “vCenter server”. i.e. we will be calling vSphere with K8s APIs against vCenter server.

Lets take look at below screenshot for how these APIs look like.


As you can see vSphere with K8s APIs are identified under name “namespace_management”, which in-turn exposes all APIs for each functional aspects of vSphere with K8s. Most critical APIs are under “namespace_management/clusters ” section, where key APIs like enable/disable/update vSphere with K8s are available. Below is how “enable” call looks like.
POST call
https://{server}/api/vcenter/namespace-management/clusters/{cluster}
server : vCenter IP/FQDN and cluster:cluster MOID


I hope, at this stage you got basic idea on where to start exploring vSphere with K8s APIs. In my next couple of posts, I will have deep dive into “enable/disable/update” vSphere with K8s on given cluster. For now lets invoke one of the basic API calls to see something cool in action.

In my lab environment, I have 2 clusters in my vCenter server (in VCF term 1 workload domain with 2 clusters), where vSphere with K8s is enabled on one and not enabled on second cluster. I chose to invoke an API, which gives us information on whether clusters in my vCenter inventory are compatible for enabling vSphere with K8s or not. As you know from my earlier posts this or this, this must be a GET call as follows


https://{server}/api/vcenter/namespace-management/cluster-compatibility


This is how you invoke it quickly from native API Explorer from within vSphere client (H5C)



Below is what I got the response, pasted as it is

Response

[vcenter.namespace_management.cluster_compatibility.summary   {

},vcenter.namespace_management.cluster_compatibility.summary   {

  • “cluster”: “domain-c9”,
  • “compatible”: “true”,
  • “incompatibility_reasons”: [ ][]

},]

As you see, my first cluster (moid: domain-c19) is not compatible and API gives us nice info on what are the basic requirements not met such as HA is not enabled, DRS is either not enabled or not in fully automated mode and new NSX-T VDS (aka conversed VDS) is not configured as well. How cool is that! As expected second cluster (moid: domain-c19) is perfectly fine as vSphere with K8s is already enabled there.

I hope you enjoyed my first post on this amazing innovation. Please stay tuned for my detailed post on its cool functional aspects. Also, here is the official documentation on “vSphere with K8s” for your further learning. I enjoyed providing my candid feedback on various aspect of this documentation last month, I am sure you will love reading it.

Once again I would like to remind you that “vSphere with K8s” is available through VCF and once you have VCF workload domain ready, you would be re-directed to vCenter H5C to proceed for further ops on managing vSphere with K8s.