Uploading kubernetes yaml files from vscode using pulumi

12/29/2020

I am doing deployment and I have drafted a YAML manifest file from a reference docker-compose file. After it has been extracted on VScode, I have to upload it to the cluster on Google Cloud Platform, please how do I do that? What is the process of moving those files to google cloud k8s using pulumi.

Many thanks.

-- Sam Bayo
devops
docker
kubernetes
pulumi
visual-studio-code

1 Answer

12/30/2020

If I'm understanding your question correctly, you have some Kubernetes resources that you want to deploy into your Google Kubernetes Engine Cluster?

If so, you can use Pulumi's Kubernetes provider to deploy Kubernetes YAML files to your cluster.

Here's an example in Python:

import pulumi
import pulumi_kubernetes as k8s

# Create resources from standard Kubernetes guestbook YAML example.
guestbook = k8s.yaml.ConfigFile('guestbook', 'guestbook-all-in-one.yaml')

# Export the private cluster IP address of the frontend.
frontend = guestbook.get_resource('v1/Service', 'frontend')
pulumi.export('private_ip', frontend.spec['cluster_ip'])

The example above assumes you have a KUBECONFIG environment variable set in your terminal with appropriate credentials and access to your GKE cluster.

You can see more details and examples (in other languages too) at https://www.pulumi.com/docs/guides/adopting/from_kubernetes/.

-- Cameron
Source: StackOverflow