Scaleway DocumentationComputeKubernetesAPI/CLI
Creating and managing a Kubernetes Kapsule

Jump toUpdate content

Creating and managing a Kubernetes Kapsule with CLI (v2)

Reviewed on 05 August 2021Published on 05 August 2021

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.

Requirements:

Configuring the CLI

  1. Open a terminal and type the following command, 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 K8s 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 K8s Kapsule cluster

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

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

    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
    Name name-of-your-cluster
    Status creating
    Version 1.22.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 K8s 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 previsouly-generated cluster:

scw k8s kubeconfig install you-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 K8s 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. 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                            12345678-1234-1234-4321-123456789123
ClusterID 12345678-1234-1234-4321-123456789123
CreatedAt now
UpdatedAt now
Name name-of-your-pool
Status scaling
Version 1.22.1
NodeType gp1_xs
Autoscaling false
Size 5
MinSize 0
MaxSize 5
ContainerRuntime containerd
Autohealing false
UpgradePolicy.MaxUnavailable 1
UpgradePolicy.MaxSurge 0
Zone fr-par-1
Region fr-par

Deleting a K8s 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 6 minutes ago
UpdatedAt now
Name new-pool
Status deleting
Version 1.22.1
NodeType gp1_xs
Autoscaling false
Size 5
MinSize 0
MaxSize 5
ContainerRuntime containerd
Autohealing false
UpgradePolicy.MaxUnavailable 1
UpgradePolicy.MaxSurge 0
Zone fr-par-1
Region fr-par

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 K8s 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
Name your-cluster
Status deleting
Version 1.22.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 1 hour ago
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 -