Skip to main content

Managed Kubernetes on OVH

A Go program to deploy a Kubernetes cluster on OVHcloud

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set ovhcloud-go-kubernetes
cd pulumi-examples/ovhcloud-go-kubernetes

Prerequisites#

You need to setup some environment variables to use this template

Terminal window
# Your OVH project ID
export OVH_SERVICE_NAME=xxx
# Your application information (can be on https://api.ovh.com/createToken)
export OVH_APPLICATION_SECRET=xxx
export OVH_APPLICATION_KEY=xxx
export OVH_CONSUMER_KEY=xxx

Configuration#

You can easily configure your setup in Pulumi.yaml

KeyDescriptionDefault value
cluster:flavorDefault size for cluster nodesd2-4
cluster:nameCluster namepulumi-cluster
cluster:nodepoolNodepool namepulumi-pool
cluster:min_nodesMinimum nb of nodes in cluster1
cluster:max_nodesMinimum nb of nodes in cluster2
cluster:regionDatacenter in which cluster will be deployedGRA9
ovh:endpointEndpoint for OVH APIsovh-eu

Usage sample#

Initialization#

If you haven’t already, follow the steps in Pulumi Installation and Setup and Configuring Pulumi Kubernetes to get set up with Pulumi and Kubernetes.

Then, run command to install go dependencies:

Terminal window
go mod download

pulumi init#

If no stack initialized, run the classic pulumi stack init command first

pulumi preview#

Terminal window
pulumi preview
Please choose a stack, or create a new one: gitpod
Previewing update (gitpod)
View in Browser (Ctrl+O): https://app.pulumi.com/yodamad/hashnode-article/gitpod/previews/xxx
Type Name Plan
+ pulumi:pulumi:Stack hashnode-article-gitpod create
+ ├─ ovh:CloudProject:Kube pulumi-cluster create
+ └─ ovh:CloudProject:KubeNodePool pulumi-pool create
Outputs:
kubeconfig: output<string>
Resources:
+ 3 to create

pulumi up#

Terminal window
pulumi up
Please choose a stack, or create a new one: gitpod
Previewing update (gitpod)
View in Browser (Ctrl+O): https://app.pulumi.com/yodamad/hashnode-article/gitpod/previews/xxx
Type Name Plan
+ pulumi:pulumi:Stack hashnode-article-gitpod create
+ ├─ ovh:CloudProject:Kube pulumi-cluster create
+ └─ ovh:CloudProject:KubeNodePool pulumi-pool create
Outputs:
kubeconfig: output<string>
Resources:
+ 3 to create
Do you want to perform this update? yes
Updating (gitpod)
View in Browser (Ctrl+O): https://app.pulumi.com/xxx/xxx/gitpod/updates/1
Type Name Status
+ pulumi:pulumi:Stack hashnode-article-gitpod created (405s)
+ ├─ ovh:CloudProject:Kube pulumi-cluster created (401s)
+ └─ ovh:CloudProject:KubeNodePool pulumi-pool created (222s)
Outputs:
kubeconfig: [secret]
Resources:
+ 3 created
Duration: 10m30s

Retrieve `kubeconfig“#

Terminal window
pulumi stack output kubeconfig --show-secrets > kubeconfig

Related

The infrastructure as code platform for any cloud.