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-kubernetesPrerequisites#
You need to setup some environment variables to use this template
# Your OVH project IDexport OVH_SERVICE_NAME=xxx# Your application information (can be on https://api.ovh.com/createToken)export OVH_APPLICATION_SECRET=xxxexport OVH_APPLICATION_KEY=xxxexport OVH_CONSUMER_KEY=xxxConfiguration#
You can easily 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 nb of nodes in cluster | 1 |
| cluster:max_nodes | Minimum nb of nodes in cluster | 2 |
| cluster:region | Datacenter in which cluster will be deployed | GRA9 |
| ovh:endpoint | Endpoint for OVH APIs | ovh-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:
go mod downloadpulumi init#
If no stack initialized, run the classic pulumi stack init command first
pulumi preview#
pulumi previewPlease choose a stack, or create a new one: gitpodPreviewing 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 createpulumi up#
pulumi upPlease choose a stack, or create a new one: gitpodPreviewing 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? yesUpdating (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: 10m30sRetrieve `kubeconfig“#
pulumi stack output kubeconfig --show-secrets > kubeconfig