Deployment of Virtual Service using @kubernetes/client-node nodejs api

1/13/2020

I am using @kubernetes/client-node nodejs API for deployment of Docker image.I could find apis for deployment of docker image and for creation of service.But there is no specific api for virtual service creation. It is working through command line.

What is the api in @kubernetes/client-node for creation of virtual service?

-- neha jain
istio
kubernetes
node.js

1 Answer

1/14/2020

Virtual service is a custom resource.Unfortunately client libraries will not have APIs for custom resources. Found this example of patching a istio virtual service using golang client . You need to try to create instead of patch. I am not 100 percent sure if this works or not.

Edit: You can install kubectl in the docker image of your pod and then execute it via code. For example in python subprocess.check_output(['kubectl', 'apply', '-f', 'virtual-service.yaml'])

-- Arghya Sadhu
Source: StackOverflow