How to make Pulumi await Kubernetes service status change?TypeScript
In order to make Pulumi wait for a Kubernetes Service status change, we can leverage the watch property of Kubernetes 'Service' type in the Pulumi Kubernetes provider.
watchproperty is set to
true, Pulumi will watch the status of the resource in Kubernetes and wait until the status is ready before the program continues.
Here's an example of how to create a Kubernetes Service with Pulumi and set the watch property:
In the above code, we first create a Kubernetes Deployment that consists of the
myappapplication. Then, we have a Kubernetes Service that selects the pods of our application and exposes them on a
LoadBalancerat port 80. When
watchis set to
true, Pulumi will wait for the Service to be ready before marking the program as done. This essentially makes Pulumi await the service status change.
You can see the status of the Kubernetes resources by running
To check that our service is running and discover the public IP address provisioned for our service, we can export the frontEnd status:
Please consult the Kubernetes documentation for more detailed usage of the Service type in Pulumi.