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.
You may need certain IAM permissions to carry out some actions described on this page. This means:
- you are the Owner of the Scaleway Organization in which the actions will be carried out, or
- you are an IAM user of the Organization, with a policy granting you the necessary permission sets
- You have an account and are logged into the Scaleway console
- You have generated your API key
- You have downloaded and installed the Scaleway CLI
Configuring the CLI
-
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.yamlaccess_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): -
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 -
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
orn
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
orn
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): -
Type
y
orn
and hit enter. This should complete the configuration process:Initialization completed with success.
Creating a K8s Kapsule cluster
-
Type the following command in your terminal to create a K8S 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 --helpID 12345678-1234-1234-4321-123456789123Type kapsuleName name-of-your-clusterStatus creatingVersion 1.28.0Region fr-parOrganizationID 12345678-1234-1234-4321-123456789123ProjectID 12345678-1234-1234-4321-123456789123Cni ciliumDescription -ClusterURL https://12345678-1234-1234-4321-123456789123.api.k8s.fr-par.scw.cloud:6443DNSWildcard *.12345678-1234-1234-4321-123456789123.nodes.k8s.fr-par.scw.cloudCreatedAt nowUpdatedAt nowDashboardEnabled falseIngress noneUpgradeAvailable falseAutoscaler configuration:ScaleDownDisabled falseScaleDownDelayAfterAdd 10mEstimator binpackingExpander randomIgnoreDaemonsetsUtilization falseBalanceSimilarNodeGroups falseExpendablePodsPriorityCutoff -10ScaleDownUnneededTime 10mScaleDownUtilizationThreshold 0.5MaxGracefulTerminationSec 600Auto-upgrade settings:Enabled falseMaintenanceWindow.StartHour 0MaintenanceWindow.Day anyOpen 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. -
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 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.
Instance type with insufficient memory are not eligible to become Nodes (DEV1-S, PLAY2-PICO, STARDUST)
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).
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-123456789123ClusterID 12345678-1234-1234-4321-123456789123CreatedAt nowUpdatedAt nowName name-of-your-poolStatus scalingVersion 1.22.1NodeType gp1_xsAutoscaling falseSize 5MinSize 0MaxSize 5ContainerRuntime containerdAutohealing falseUpgradePolicy.MaxUnavailable 1UpgradePolicy.MaxSurge 0Zone fr-par-1Region fr-par
Deleting a K8s pool
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-123456789123ClusterID 12345678-1234-1234-4321-123456789123CreatedAt 6 minutes agoUpdatedAt nowName new-poolStatus deletingVersion 1.22.1NodeType gp1_xsAutoscaling falseSize 5MinSize 0MaxSize 5ContainerRuntime containerdAutohealing falseUpgradePolicy.MaxUnavailable 1UpgradePolicy.MaxSurge 0Zone fr-par-1Region 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
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-123456789123Name your-clusterStatus deletingVersion 1.22.1Region fr-parOrganizationID 12345678-1234-1234-4321-123456789123ProjectID 12345678-1234-1234-4321-123456789123Cni ciliumDescription -ClusterURL https://12345678-1234-1234-4321-123456789123.api.k8s.fr-par.scw.cloud:6443DNSWildcard *.12345678-1234-1234-4321-123456789123.nodes.k8s.fr-par.scw.cloudCreatedAt 1 hour agoUpdatedAt nowDashboardEnabled falseIngress noneUpgradeAvailable falseAutoscaler configuration:ScaleDownDisabled falseScaleDownDelayAfterAdd 10mEstimator binpackingExpander randomIgnoreDaemonsetsUtilization falseBalanceSimilarNodeGroups falseExpendablePodsPriorityCutoff -10ScaleDownUnneededTime 10mScaleDownUtilizationThreshold 0.5MaxGracefulTerminationSec 600Auto-upgrade settings:Enabled falseMaintenanceWindow.StartHour 0MaintenanceWindow.Day anyOpen ID Connect configuration:IssuerURL -ClientID -UsernameClaim -UsernamePrefix -GroupsPrefix -