scalewayterraform

Private Kubernetes on Scaleway with Terraform

Summary: This wiki page shows how to create a private kubernetes cluster in Scaleway, one of the upcoming European Cloud Providers, using Terraform. It is a followup of Private Kubernetes on Scaleway.
Date: 1 July 2026

Let's first review the network diagram of what we created manually using the console in Private Kubernetes on Scaleway:

Network diagram for Scaleway Private Network with K8s


In this page we'll try to do the same, only then using the Scaleway Terraform Provider.

The Terraform App

To deploy all required resources using terraform I've defined a new terraform app within my public repo. The setup regarding resources is roughly the same, as we define various resources, mostly using modules. We do have a few extra's though, of which the most eye-catching is the option to add a public ssh key. These are the kind of things you don't really think about when deploying resourcing using clickOps but they are crucial when trying to connect to your resources. Another interesting option is the ability to configure the k8s network. Using terraform exposes way more options to the API then the console does, which means we can now configure the pod and service CIDR as well as the DNS service IP.

All together the following resources and modules are used:

  • main.tf: Defines the provider. Note that the details in the scaleway provider are fake and need to be replaced. I use a override file for that.
  • network.tf: Creates the VPC using this module, as well as the private networks using this module.
  • instance.tf: Creates a linux instance into the private network using this module.
  • public_gateway.tf: Creates the public gateway to allow access to the instance and the k8s cluster using this module.
  • private_kapsule.tf: Creates an isolated kapsule k8s cluster using this module.
  • container_registry.tf: Creates the private container registry to be used by the k8s cluster.
  • ssh_key.tf: Creates the ssh key to be used with the linux instance and k8s cluster.

Use the App

To use the app, simply clone the repository, navigate to the app folder (scwPrivateK8s)), replace the values in the main.tf file and issue the following commands:

terraform init
terraform plan
terraform apply

Always read the terraform plan very careful, to avoid the unintended removal of resources.

If needed, you can remove all resources again using terraform destroy

This wiki has been made possible by:

scalewayterraform.txt · Last modified: by 127.0.0.1