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:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set ovhcloud-go-kubernetescd pulumi-examples/ovhcloud-go-kubernetesDeploys a managed Kubernetes cluster and node pool on OVHcloud.
Prerequisites#
-
Set up the environment variables used to authenticate against the OVH APIs:
Terminal window # Your OVH project IDexport OVH_SERVICE_NAME=xxx# Your application information (can be created on https://api.ovh.com/createToken)export OVH_APPLICATION_SECRET=xxxexport OVH_APPLICATION_KEY=xxxexport OVH_CONSUMER_KEY=xxx
Configuration#
You can configure your setup in Pulumi.yaml:
| Key | Description | Default value |
|---|---|---|
| cluster:flavor | Default size for cluster nodes | d2-4 |
| cluster:name | Cluster name | pulumi-cluster |
| cluster:nodepool | Nodepool name | pulumi-pool |
| cluster:min_nodes | Minimum number of nodes in cluster | 1 |
| cluster:max_nodes | Maximum number of nodes in cluster | 2 |
| cluster:region | Datacenter in which cluster will be deployed | GRA9 |
| ovh:endpoint | Endpoint for OVH APIs | ovh-eu |
Deploying the example#
-
Install dependencies:
Terminal window go mod download -
Create a new stack:
Terminal window pulumi stack init -
Run
pulumi upto preview and deploy changes:Terminal window pulumi upUpdating (gitpod)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 createdDuration: 10m30s -
Retrieve the
kubeconfig:Terminal window pulumi stack output kubeconfig --show-secrets > kubeconfig
Cleaning up#
Once you’re finished experimenting, destroy your stack and remove it to avoid incurring any additional cost:
pulumi destroypulumi stack rm