Skip to navigationSkip to main contentSkip to footerScaleway Docs HomepageAsk our AI
Ask our AI

Creating and managing a Kubernetes Kapsule with CLI (v2)

Scaleway's Kubernetes (K8s) Kapsule provides you with a managed environment to create, configure and run a cluster of pre-configured machines for containerized applications. You will be able to create clusters without the complexity of managing the infrastructure.

You can create and manage your Kapsule clusters from the console, via the API or via the Scaleway Command Line Interface.

Scaleway command line interface overview

The Scaleway command line interface (CLI) allows you to pilot your Scaleway infrastructure directly from your terminal, providing a faster way to administer and monitor your resources. Scaleway CLI is easy to set up and is an essential tool for operating efficiently in your cloud environment. The CLI provides many functionalities, including the ability to create and manage Kubernetes clusters.

Before you start

To complete the actions presented below, you must have:

Configuring the CLI

  1. Run the following command into your terminal to configure the Scaleway CLI on your machine:

    scw init

    If you have already configured the CLI, you will see a message like the following:

    Current config is located at /path/to/config.yaml
    access_key: <YOUR ACCESS KEY>
    secret_key: <YOUR SECRET KEY>
    default_organization_id: <YOUR ORGANIZATION ID>
    default_project_id: <YOUR PROJECT ID>
    default_region: <YOUR DEFAULT REGION, eg fr-par>
    default_zone: <YOUR DEFAULT ZONE, eg fr-par-1>
    
    Do you want to override the current config? (Y/n):
  2. Type n and go directly to the Creating a Kubernetes Kapsule cluster step of this tutorial, if you do not want to edit your configuration.

    If you have not yet configured the CLI, you will be guided through the configuration process via a series of questions:

    Enter a valid secret-key or an email
  3. Enter either the email address for your account (you will then be asked for your password), or your API secret key:

    To improve this tool we rely on diagnostic and usage data.
    Sending such data is optional and can be disabled at any time by running "scw config set send-telemetry=false".
    Do you want to send usage statistics and diagnostics? (Y/n):

    Type y or n and hit enter.

    To fully enjoy Scaleway CLI we recommend you install autocomplete support in your shell.
    Do you want to install autocomplete? (Y/n):

    Type y or n and hit enter.

    To enable autocomplete, scw needs to update your shell configuration.
    What type of shell are you using (default: zsh):

    Hit enter if the default shell type is already correct for you. Otherwise, enter your shell type and hit enter.

    To enable autocomplete we need to append to /Users/yourusername/.zshrc the following lines:
    # Scaleway CLI autocomplete initialization.
    eval "$(scw autocomplete script shell=zsh)"
    Do you want to proceed with these changes? (Y/n):
  4. Type y or n and hit enter. This should complete the configuration process:

    Initialization completed with success.

Creating a Kubernetes Kapsule cluster

  1. Type the following command in your terminal to create a Kubernetes Kapsule cluster:

    scw k8s cluster create name=name-of-your-cluster

    Tip

    You can add the type argument to specify the cluster type. For an extensive list of the available cluster types, run the list cluster types CLI command. If you do not specify a cluster type, a cluster of Kapsule type is created by default.

    It is possible to change the cluster type anytime. Depending on your current cluster type, the types you can change to vary. Refer to the Changing the control plane offer documentation page for more information.

    For more information about cluster types, refer to the Kubernetes FAQ page.

    You will see an output similar to this:

    The argument 'enable-dashboard' is deprecated, more info with: scw k8s cluster create --help
    ID                12345678-1234-1234-4321-123456789123
    Type              kapsule
    Name              name-of-your-cluster
    Status            creating
    Version           1.29.1
    Region            fr-par
    OrganizationID    12345678-1234-1234-4321-123456789123
    ProjectID         12345678-1234-1234-4321-123456789123
    Cni               cilium
    Description       -
    ClusterURL        https://12345678-1234-1234-4321-123456789123.api.k8s.fr-par.scw.cloud:6443
    DNSWildcard       *.12345678-1234-1234-4321-123456789123.nodes.k8s.fr-par.scw.cloud
    CreatedAt         now
    UpdatedAt         now
    DashboardEnabled  false
    Ingress           none
    UpgradeAvailable  false
    
    Autoscaler configuration:
    ScaleDownDisabled              false
    ScaleDownDelayAfterAdd         10m
    Estimator                      binpacking
    Expander                       random
    IgnoreDaemonsetsUtilization    false
    BalanceSimilarNodeGroups       false
    ExpendablePodsPriorityCutoff   -10
    ScaleDownUnneededTime          10m
    ScaleDownUtilizationThreshold  0.5
    MaxGracefulTerminationSec      600
    
    Auto-upgrade settings:
    Enabled                      false
    MaintenanceWindow.StartHour  0
    MaintenanceWindow.Day        any
    
    Open ID Connect configuration:
    IssuerURL       -
    ClientID        -
    UsernameClaim   -
    UsernamePrefix  -
    GroupsPrefix    -
    Note

    For more information about the creation of a Kubernetes cluster, type scw k8s cluster create --help in your terminal.

  2. Write down the ID of your cluster, as you will need it in the next steps.

Installing a Kubeconfig configuration file

Type the following command in your terminal and replace your-cluster-ID with the ID of your previously generated cluster:

scw k8s kubeconfig install your-cluster-ID

You will see the following output:

Kubeconfig for cluster your-cluster-ID successfully written at /Users/yourusername/.kube/config

Adding a pool to a Kubernetes cluster

A pool is a set of identical nodes. A pool has a name, a size (its current number of nodes), nodes number limits (min and max), and a Scaleway Instance type.

Note

Instance type with insufficient (less than 4 GB) memory are not eligible to become nodes.

Changing these limits increases/decreases the size of a pool. Thus, when autoscaling is enabled, the pool will grow or shrink inside those limits, depending on its load.

Note

For more information about pools, refer to the Scaleway CLI documentation.

Type the following command in your terminal:

scw k8s pool create cluster-id=id-of-your-cluster name=name-of-your-pool node-type=GP1_XS size=number-of-nodes-wanted

You will see an output similar to this:

ID                            87654321-1234-1234-4321-123456789123
ClusterID                     12345678-1234-1234-4321-123456789123
CreatedAt                     now
UpdatedAt                     now
Name                          name-of-your-pool
Status                        scaling
Version                       1.29.1
NodeType                      gp1_xs
Autoscaling                   false
Size                          1
MinSize                       0
MaxSize                       1
ContainerRuntime              containerd
Autohealing                   false
UpgradePolicy.MaxUnavailable  1
UpgradePolicy.MaxSurge        0
Zone                          fr-par-1
RootVolumeType                l_ssd
RootVolumeSize                150 GB
PublicIPDisabled              false
Region                        fr-par

Node labels:


Node taints:
KEY  VALUE  EFFECT

Node startup taints:
KEY  VALUE  EFFECT

Configuring a node label for your pool(s)

Adding a node label to your pool(s)

You can add a node label to a single pool or multiple pools using the scw k8s pool set-label command.

In the following example, you are going to add a node label to one pool.

Execute the following command in your terminal. Remember to replace the placeholder values with your actual values.

scw k8s pool set-label pool-id key=your-label-key value=your-label-value

You will see an output similar to this:

ID                17654321-1234-1234-4321-123456789123
ClusterID         12345678-1234-1234-4321-123456789123
CreatedAt         2 minutes ago
UpdatedAt         now
Name              name-of-your-pool
Status            ready
Version           1.35.3
NodeType          gp1_xs
Autoscaling       false
Size              2
MinSize           0
MaxSize           2
ContainerRuntime  containerd
Autohealing       false
Zone              fr-par-1
RootVolumeType    l_ssd
RootVolumeSize    150 GB
PublicIPDisabled  false
SecurityGroupID   11a22334-ab45-56bc-cc7d-7de8ef8f99gh
Region            fr-par

Upgrade Policy:
MaxUnavailable  1
MaxSurge        0

Node labels:
your-label-key  your-label-value

Node taints:
KEY  VALUE  EFFECT

Node startup taints:
KEY                   VALUE                   EFFECT

To add a node label to multiple pools, specify the pool identifiers one after the other:

scw k8s pool set-label pool-id-1 pool-id-2 pool-id-3 key=your-label-key value=your-label-value

Removing a node label from your pool(s)

You can remove a node label from a single pool or multiple pools using the scw k8s pool remove-label command.

In the following example, you are going to remove a node label from one pool.

Execute the following command in your terminal. Remember to replace the placeholder values with your actual values.

scw k8s pool remove-label pool-id key=your-label-key
ID                17654321-1234-1234-4321-123456789123
ClusterID         12345678-1234-1234-4321-123456789123
CreatedAt         5 minutes ago
UpdatedAt         now
Name              name-of-your-pool
Status            ready
Version           1.35.3
NodeType          gp1_xs
Autoscaling       false
Size              2
MinSize           0
MaxSize           2
ContainerRuntime  containerd
Autohealing       false
Zone              fr-par-1
RootVolumeType    l_ssd
RootVolumeSize    150 GB
PublicIPDisabled  false
SecurityGroupID   11a22334-ab45-56bc-cc7d-7de8ef8f99gh
Region            fr-par

Upgrade Policy:
MaxUnavailable  1
MaxSurge        0

Node labels:


Node taints:
KEY  VALUE  EFFECT

Node startup taints:
KEY                   VALUE                   EFFECT

To remove a node label from multiple pools, specify the pool identifiers one after the other:

scw k8s pool remove-label pool-id-1 pool-id-2 pool-id-3 key=your-label-key

Configuring a startup taint for your pool(s)

Adding a startup taint to your pool(s)

You can add a startup taint to a single pool or multiple pools using the scw k8s pool set-startup-taint command.

In the following example, you are going to add a startup taint to one pool.

Execute the following command in your terminal. Remember to replace the placeholder values with your actual values.

scw k8s pool set-startup-taint pool-id key=your-startup-taint-key value=your-startup-taint-value effect=NoExecute

You will see an output similar to this:

ID                17654321-1234-1234-4321-123456789123
ClusterID         12345678-1234-1234-4321-123456789123
CreatedAt         2 minutes ago
UpdatedAt         now
Name              name-of-your-pool
Status            ready
Version           1.35.3
NodeType          gp1_xs
Autoscaling       false
Size              2
MinSize           0
MaxSize           2
ContainerRuntime  containerd
Autohealing       false
Zone              fr-par-1
RootVolumeType    l_ssd
RootVolumeSize    150 GB
PublicIPDisabled  false
SecurityGroupID   11a22334-ab45-56bc-cc7d-7de8ef8f99gh
Region            fr-par

Upgrade Policy:
MaxUnavailable  1
MaxSurge        0

Node labels:


Node taints:
KEY  VALUE  EFFECT

Node startup taints:
KEY                     VALUE                     EFFECT
your-startup-taint-key  your-startup-taint-value  NoExecute

To add a startup taint to multiple pools, specify the pool identifiers one after the other:

scw k8s pool set-startup-taint pool-id-1 pool-id-2 pool-id-3 key=your-startup-taint-key value=your-startup-taint-value effect=NoExecute
Note

The startup taints you configure for your pool(s) are automatically applied to any new node created within the pool(s).

Remember to add the appropriate tolerations in your Pod YAML manifests for any Pod that needs to run on a tainted node.

Removing a startup taint from your pool(s)

You can remove a startup taint from a single pool or multiple pools using the scw k8s pool remove-startup-taint command.

In the following example, you are going to remove a startup taint from one pool.

Execute the following command in your terminal. Remember to replace the placeholder values with your actual values.

scw k8s pool remove-startup-taint pool-id key=your-startup-taint-key

You will see an output similar to this:

ID                27654321-1234-1234-4321-123456789123
ClusterID         12345678-1234-1234-4321-123456789123
CreatedAt         5 minutes ago
UpdatedAt         now
Name              name-of-your-pool
Status            ready
Version           1.35.3
NodeType          gp1_xs
Autoscaling       false
Size              1
MinSize           0
MaxSize           1
ContainerRuntime  containerd
Autohealing       false
Zone              fr-par-1
RootVolumeType    l_ssd
RootVolumeSize    150 GB
PublicIPDisabled  false
SecurityGroupID   11a22334-ab45-56bc-cc7d-7de8ef8f99gh
Region            fr-par

Upgrade Policy:
MaxUnavailable  1
MaxSurge        0

Node labels:


Node taints:
KEY  VALUE  EFFECT

Node startup taints:
KEY  VALUE  EFFECT

To remove a startup taint from multiple pools, specify the pool identifiers one after the other:

scw k8s pool remove-startup-taint pool-id-1 pool-id-2 pool-id-3 key=your-startup-taint-key value=your-startup-taint-value effect=NoExecute

Configuring a taint for your pool(s)

Adding a taint to your pool(s)

You can add a taint to a single pool or multiple pools using the scw k8s pool set-taint command.

In the following example, you are going to add a taint to one pool.

Execute the following command in your terminal. Remember to replace the placeholder values with your actual values.

scw k8s pool set-taint pool-id key=your-taint-key value=your-taint-value effect=NoExecute

You will see an output similar to this:

ID                17654321-1234-1234-4321-123456789123
ClusterID         12345678-1234-1234-4321-123456789123
CreatedAt         2 minutes ago
UpdatedAt         now
Name              name-of-your-pool
Status            ready
Version           1.35.3
NodeType          gp1_xs
Autoscaling       false
Size              3
MinSize           0
MaxSize           2
ContainerRuntime  containerd
Autohealing       false
Zone              fr-par-1
RootVolumeType    l_ssd
RootVolumeSize    150 GB
PublicIPDisabled  false
SecurityGroupID   11a22334-ab45-56bc-cc7d-7de8ef8f99gh
Region            fr-par

Upgrade Policy:
MaxUnavailable  1
MaxSurge        0

Node labels:


Node taints:
KEY                VALUE                EFFECT
your-taint-key     your-taint-value     NoExecute

Node startup taints:
KEY  VALUE  EFFECT

To add a taint to multiple pools, specify the pool identifiers one after the other:

scw k8s pool set-taint pool-id-1 pool-id-2 pool-id-3 key=your-taint-key value=your-taint-value effect=NoExecute
Note

The taints you configure for your pool(s) are automatically applied to any new node created within the pool(s).

Remember to add the appropriate tolerations in your Pod YAML manifests for any Pod that needs to run on a tainted node.

Removing a taint from your pool(s)

You can remove a taint from a single pool or multiple pools using the scw k8s pool remove-taint command.

In the following example, you are going to remove a startup taint from one pool.

Execute the following command in your terminal. Remember to replace the placeholder values with your actual values.

scw k8s pool remove-taint pool-id key=your-taint-key

You should get a similar output:

ID                17654321-1234-1234-4321-123456789123
ClusterID         12345678-1234-1234-4321-123456789123
CreatedAt         2 minutes ago
UpdatedAt         now
Name              name-of-your-pool
Status            ready
Version           1.35.3
NodeType          gp1_xs
Autoscaling       false
Size              2
MinSize           0
MaxSize           2
ContainerRuntime  containerd
Autohealing       false
Zone              fr-par-1
RootVolumeType    l_ssd
RootVolumeSize    150 GB
PublicIPDisabled  false
SecurityGroupID   11a22334-ab45-56bc-cc7d-7de8ef8f99gh
Region            fr-par

Upgrade Policy:
MaxUnavailable  1
MaxSurge        0

Node labels:


Node taints:
KEY  VALUE  EFFECT

Node startup taints:
KEY  VALUE  EFFECT

To remove a taint from multiple pools, specify the pool identifiers one after the other:

scw k8s pool remove-taint pool-id-1 pool-id-2 pool-id-3 key=your-taint-key

Deleting a Kubernetes pool

Important

This will permanently destroy your pool. All pool data stored on local volume will be destroyed.

Type the following command in your terminal and replace your-pool-ID with the pool ID you want to delete:

scw k8s pool delete your-pool-ID

You will see an output similar to this:

ID                            12345678-1234-1234-4321-123456789123
ClusterID                     12345678-1234-1234-4321-123456789123
CreatedAt                     1 minute ago
UpdatedAt                     now
Name                          my-node-pool
Status                        deleting
Version                       1.29.1
NodeType                      gp1_xs
Autoscaling                   false
Size                          1
MinSize                       0
MaxSize                       1
ContainerRuntime              containerd
Autohealing                   false
UpgradePolicy.MaxUnavailable  1
UpgradePolicy.MaxSurge        0
Zone                          fr-par-1
RootVolumeType                l_ssd
RootVolumeSize                150 GB
PublicIPDisabled              false
Region                        fr-par


Node labels:


Node taints:
KEY  VALUE  EFFECT

Node startup taints:
KEY  VALUE  EFFECT

Your pool has been deleted.

Uninstalling a Kubeconfig from a specific cluster

Type the following command in your terminal and replace your-cluster-ID with the cluster ID you want to delete the Kubeconfig from:

scw k8s kubeconfig uninstall your-cluster-ID

You will get an output similar to this:

Cluster your-cluster-ID successfully deleted from /Users/yourusername/.kube/config

Deleting a Kubernetes cluster

Important

This will permanently destroy your cluster and all associated pools and Instances.

Type the following command in your terminal and replace your-cluster-ID with the ID of the cluster you want to delete:

scw k8s cluster delete "your-cluster-ID"

You will see an output similar to this:

ID                12345678-1234-1234-4321-123456789123
Type              kapsule
Name              name-of-your-cluster
Status            deleting
Version           1.29.1
Region            fr-par
OrganizationID    12345678-1234-1234-4321-123456789123
ProjectID         12345678-1234-1234-4321-123456789123
Cni               cilium
Description       -
ClusterURL        https://12345678-1234-1234-4321-123456789123.api.k8s.fr-par.scw.cloud:6443
DNSWildcard       *.12345678-1234-1234-4321-123456789123.nodes.k8s.fr-par.scw.cloud
CreatedAt         6 minutes ago
UpdatedAt         now
UpgradeAvailable  false
PrivateNetworkID  12345678-1234-1234-4321-123456789123
CommitmentEndsAt  6 minutes ago

Autoscaler configuration:
ScaleDownDisabled              false
ScaleDownDelayAfterAdd         10m
Estimator                      binpacking
Expander                       random
IgnoreDaemonsetsUtilization    false
BalanceSimilarNodeGroups       false
ExpendablePodsPriorityCutoff   -10
ScaleDownUnneededTime          10m
ScaleDownUtilizationThreshold  0.5
MaxGracefulTerminationSec      600

Auto-upgrade settings:
Enabled                      false
MaintenanceWindow.StartHour  0
MaintenanceWindow.Day        any

Open ID Connect configuration:
IssuerURL       -
ClientID        -
UsernameClaim   -
UsernamePrefix  -
GroupsPrefix    -
Still need help?

Create a support ticket
No Results