Script to Configure vSphere Supervisor Cluster using REST APIs

Last week I introduced you to vSphere Supervisor cluster APIs and also had a post on how to use DCLI for managing vSphere Supervisor cluster. In this post, I am going to show you how to enable/configure vSphere Supervisor cluster and also create namespace on the top of vSphere Supervisor cluster.
These key APIs are demonstrated using couple of python scripts. This time I thought let me try little different style of writing. I am sure you will enjoy learning.

1. Enable/configure vSphere Supervisor cluster :

Where to refer REST
API documentation?
Official API documentation
or H5C –> Developer Center –> API Explorer
How do I land from VCF 4.0 on to vSphere for configuring this key workflow? Refer this cool short video
VCF 4.0 SDDC manager by Cormac
How do I create base setup for
labs, learning purpose?
Refer this cool deployment script
by William
My python script to configure Supervisor cluster on base setup script.
Used python library “requests” to call APIs. We can use other “vSphere Automation SDKs” as well


Automating supervisor cluster workflows using Java SDK
Enable vSphere Supervisor cluster API POST https://{server}/api/vcenter/namespace-management/clusters/{cluster} ?action=enable
Complete API Spec/payload for above POST call API Spec
Enable API Spec/Payload I passed in my scriptGithub link for spec
you can use the same for postman call
How did I fetched inputs needed to be passed into POST Call? Refer line 139 through 178 in script
Sample runShown below
How it looks in UI before & after ?Shown below

How to run script :
C:\vThinkBeyondVM\vcpy>python -s “10.x.x.x” -u “Administrator@vsphere.local” -cl “WCP-cluster-1” -mnw “VM Network” -sip “10.x.x.x” -sm “255.255.x.x” -gw “10.x.x.x” -dns “10.x.x.x” -ntp “10.x.x.x” -sp “k8s-gc-policy” -egress “10.x.x.x” -ingress “10.x.x.x”

Password will be asked on CLI. You might wonder, am I not passing VDS and Edge cluster? please refer the line 161 through 170. REST APIs allowed me to use some trick.

Which UI workflow is automated?
This python script automates below UI worklow, where user will configure workload network, management network, storage etc.

How it looks from UI
once Super visor cluster is enabled, this is how it looks (H5C > Menu > Workload Management)

2. Creating your first namespace using script

Create namespace URL POST https://{server}/api/vcenter/namespaces/instances
API payload/specpayload
How to runShown below
How it looks from UIShown below

How to run script:
C:\vThinkBeyondVM\vcpy>python -s 10.x.x.x -u Administrator@vsphere.local -cl WCP-cluster-1 -role EDIT -st USER -subject Administrator -domain vsphere.local -sp k8s-gc-policy -ns my-ns-2

How it looks from UI ?

I hope you enjoyed learning. Please stay tuned for upcoming posts around vSphere with K8s and other vSphere 7.0 functionality. Let me know if you have any queries, feedback.

Further reading:
1. REST API documentation
2. How to get vSphere with Kubernetes?
3. Introduction to manage vSphere Supervisor Cluster using API
4. Automating supervisor cluster workflows using Java SDK
5. vSphere with Kubernetes 101 is here
6. Official documentation for vSphere with Kubernetes is here

19 thoughts on “Script to Configure vSphere Supervisor Cluster using REST APIs

  1. About register Proactive Provider (the form module doesn’t work, this is why I write here) with, I’ve got this error message:
    Traceback (most recent call last):
    File “”, line 31, in
    providerId = heath_update_mgr.RegisterHealthUpdateProvider(name,health_updates)
    File “/usr/local/lib/python3.7/site-packages/pyVmomi/”, line 706, in
    self.f(*(self.args + (obj,) + args), **kwargs)
    File “/usr/local/lib/python3.7/site-packages/pyVmomi/”, line 512, in _InvokeMethod
    return self._stub.InvokeMethod(self, info, args)
    File “/usr/local/lib/python3.7/site-packages/pyVmomi/”, line 1397, in InvokeMethod
    raise obj # pylint: disable-msg=E0702
    pyVmomi.VmomiSupport.InvalidArgument: (vmodl.fault.InvalidArgument) {
    dynamicType = ,
    dynamicProperty = (vmodl.DynamicProperty) [],
    msg = ‘A specified parameter was not correct: providerId’,
    faultCause = ,
    faultMessage = (vmodl.LocalizableMessage) [
    (vmodl.LocalizableMessage) {
    dynamicType = ,
    dynamicProperty = (vmodl.DynamicProperty) [],
    key = ‘com.vmware.vim.healthUpdateManager.associatedEntity’,
    arg = (vmodl.KeyAnyValue) [
    (vmodl.KeyAnyValue) {
    dynamicType = ,
    dynamicProperty = (vmodl.DynamicProperty) [],
    key = ‘arg’,
    value = ‘ProHAProvider1’
    message = ‘Entity ProHAProvider1 is already associated.’
    invalidProperty = ‘providerId’

  2. Trulife Distribution – Nutrition Distribution helps our clients achieve success in a complex, competitive retail environment. Our team of nutrition industry experts takes care of everything from importation compliance to marketing, sales and distribution at the ground level. There is no need to navigate the complicated intricacies of the American market when we have already done the work. Let us use our experience to expand your brand and put your product into the hands of American consumers.

  3. Great goods from you, man. I have be aware your stuff previous to and you’re simply extremely
    wonderful. I really like what you’ve bought here, really like what
    you’re saying and the best way during which you are saying it.
    You’re making it enjoyable and you still care for to stay it wise.
    I can’t wait to read much more from you. This is really a terrific website.

  4. When I initially commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get three e-mails with the same
    comment. Is there any way you can remove people from that service?
    Thanks a lot!

    my web blog: gema club suncity

  5. I have to thank you for the efforts you’ve put in writing
    this site. I really hope to see the same high-grade blog posts by you in the future as well.

    In truth, your creative writing abilities has inspired me to
    get my very own website now 😉

    my blog – kiss918 test id

  6. My developer is trying to persuade me to move to
    .net from PHP. I have always disliked the idea because of the
    expenses. But he’s tryiong none the less. I’ve been using WordPress on several websites
    for about a year and am concerned about switching to another platform.
    I have heard very good things about Is there a way
    I can transfer all my wordpress posts into it? Any kind of help would be
    greatly appreciated!

    my web-site gem 918kaya

  7. I don’t even know how I finished up here, but I assumed this
    put up was once good. I do not recognize who you are but certainly you are going to a
    famous blogger in the event you aren’t already. Cheers!

    Here is my page: joker688

  8. I’ve been exploring for a bit for any high quality
    articles or blog posts in this kind of space . Exploring
    in Yahoo I ultimately stumbled upon this site. Studying this information So i am glad to convey that I’ve a very just right uncanny feeling
    I came upon just what I needed. I such a lot without a doubt will make sure to
    do not put out of your mind this website and provides
    it a look regularly.

    Feel free to visit my web-site – Download Aaa1188

Leave a Reply

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