Skip to content

Commit 8b97427

Browse files
committed
feat(kubernetes): add fully isolated kubernetes cluster connection page ext-add-kubernetes
1 parent 1aac2f2 commit 8b97427

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: How to connect to a fully isolated Kubernetes Kapsule cluster using Public Gateway
3+
description: Learn how to connect to a private Kubernetes cluster using kubectl and Public Gateway. Follow steps to connect securely to your cluster while ensuring its networking isolation.
4+
tags: connection cluster kubectl public-gateways
5+
dates:
6+
validation: 2025-12-04
7+
posted: 2025-12-04
8+
---
9+
import Requirements from '@macros/iam/requirements.mdx'
10+
11+
12+
When [creating your cluster](/kubernetes/how-to/create-cluster/), you can choose to connect it to a Private Network using [full isolation](/kubernetes/reference-content/secure-cluster-with-private-network/#what-is-the-difference-between-controlled-isolation-and-full-isolation). The control plane is created without a public IP, and a [Public Gateway](/public-gateways/how-to/configure-a-public-gateway/) is required to connect to it.
13+
14+
You can connect to the control plane using your Public Gateway's [SSH bastion](/public-gateways/how-to/use-ssh-bastion/). This lets you manage your cluster using `kubectl` and other tools while ensuring that its control plane is not exposed to the Internet.
15+
16+
<Requirements />
17+
18+
- A [Scaleway account](https://console.scaleway.com) logged into the console.
19+
- [Owner status](https://console.scaleway.com) or [IAM permissions](/iam/concepts/#permission) to perform actions in the intended Organization.
20+
- Created a [Private Network](/vpc/how-to/create-private-network/) with an attached [Public Gateway](/public-gateways/how-to/create-a-public-gateway/) with [SSH bastion](/public-gateways/how-to/use-ssh-bastion/) enabled.
21+
- Created a [Kubernetes Kapsule cluster](/kubernetes/how-to/create-cluster/) attached to the aforementioned Private Network, and configured with [full isolation](/kubernetes/reference-content/secure-cluster-with-private-network/#what-is-the-difference-between-controlled-isolation-and-full-isolation).
22+
- [kubectl](https://kubernetes.io/docs/tasks/tools/) installed locally.
23+
- The [Scaleway CLI](/scaleway-cli/quickstart/) installed locally.
24+
- Downloaded [a `kubeconfig` file](https://www.scaleway.com/en/docs/kubernetes/how-to/connect-cluster-kubectl/) from the Scaleway console.
25+
26+
## Opening a SSH tunnel to the Kubernetes Kapsule control plane
27+
28+
To connect to the fully isolated Kubernetes Kapsule control plane, you can open a SSH tunnel using the Public Gateway's SSH bastion. This will port-forward the control plane to a local port, to which you can then connect.
29+
30+
### Finding your cluster's URL
31+
32+
In the Scaleway console, go to the [Kubernetes product section](https://console.scaleway.com/kubernetes), then click your cluster's name.
33+
34+
Scroll down to the **Network** section, and click on the **URL** value. The URL is copied to your clipboard.
35+
36+
### Opening the SSH tunnel
37+
38+
Open a terminal on your computer, then run the following command:
39+
40+
```bash
41+
ssh -fNL 6443:<CLUSTER_URL_WITHOUT_HTTPS> bastion@<PUBLIC_GATEWAY_PUBLIC_IP> -p <SSH_BASTION_PORT>
42+
```
43+
44+
Make sure to replace the values with the appropriate values. `<CLUSTER_URL_WITHOUT_HTTPS>` should end in `:6443`, which is the control plane's port.
45+
46+
Here is an example command:
47+
48+
```bash
49+
ssh -fNL 6443:1379355f-f36a-4383-9791-b6c573dea811.api.k8s.fr-par.scw.cloud:6443 bastion@51.159.153.192 -p 61000
50+
```
51+
52+
<Message type="note">
53+
54+
The command contains several `ssh` flags:
55+
56+
- `-f` runs the command in the background;
57+
- `-N` tells `ssh` not to run a remote command, which is the case here since we only want to port-forward;
58+
- `-L` sets up port-forwarding from a local port (here, port `6443`) and a given host and port on the remote side;
59+
- `-p` indicates the remote SSH port.
60+
61+
</Message>
62+
63+
A tunnel to the Kubernetes Kapsule control plane is opened: all local traffic to port `6443` will now be redirected to the control plane through the Public Gateway's SSH bastion.
64+
65+
## Accessing the cluster
66+
67+
### Editing the `/etc/hosts` file
68+
69+
The downloaded `kubeconfig` file points to the control plane's URL, which is currently unreachable due to its lack of public IP. However, you can redirect traffic to your local port-forwarded port by editing your `/etc/hosts` file.
70+
71+
Open the `/etc/hosts` file on your computer using a text editor, and add the following line:
72+
73+
```
74+
127.0.0.1 <CLUSTER_URL_WITHOUT_HTTPS>
75+
```
76+
77+
Using the same values as the previous example, the line would be:
78+
79+
```
80+
127.0.0.1 1379355f-f36a-4383-9791-b6c573dea811.api.k8s.fr-par.scw.cloud
81+
```
82+
83+
Processes on your computer now resolve your cluster's hostname to `127.0.0.1`, your `localhost` address.
84+
85+
### Using `kubectl`
86+
87+
You can now manage your cluster using `kubectl`. Run the following command:
88+
89+
```bash
90+
kubectl get nodes
91+
```
92+
93+
A list of nodes from your Kapsule cluster should appear.
94+
95+
<Message type="note">
96+
97+
You need to run the `ssh` command again every time your computer reboots. This can be automated using various tools such as shell scripts.
98+
99+
</Message>

0 commit comments

Comments
 (0)