| 1 |
# Use apiserver-network-proxy with KIND |
| 2 |
|
| 3 |
|
| 4 |
Change to the `examples/kind` folder and create a `kind` cluster with the `kind.config` file |
| 5 |
|
| 6 |
```sh |
| 7 |
$ kind create cluster --config kind.config |
| 8 |
Creating cluster "kind" ... |
| 9 |
DEBUG: docker/images.go:58] Image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72 present locally |
| 10 |
✓ Ensuring node image (kindest/node:v1.27.3) 🖼 |
| 11 |
⠎⠁ Preparing nodes 📦 📦 📦 |
| 12 |
|
| 13 |
This node has joined the cluster: |
| 14 |
* Certificate signing request was sent to apiserver and a response was received. |
| 15 |
* The Kubelet was informed of the new secure connection details. |
| 16 |
|
| 17 |
Run 'kubectl get nodes' on the control-plane to see this node join the cluster. |
| 18 |
✓ Joining worker nodes 🚜 |
| 19 |
Set kubectl context to "kind-kind" |
| 20 |
You can now use your cluster with: |
| 21 |
|
| 22 |
kubectl cluster-info --context kind-kind |
| 23 |
|
| 24 |
Have a nice day! 👋 |
| 25 |
``` |
| 26 |
|
| 27 |
Once the cluster is ready install the `apiserver-network-proxy` components: |
| 28 |
|
| 29 |
```sh |
| 30 |
$ kubectl apply -f konnectivity-server.yaml |
| 31 |
clusterrolebinding.rbac.authorization.k8s.io/system:konnectivity-server created |
| 32 |
daemonset.apps/konnectivity-server created |
| 33 |
|
| 34 |
$ kubectl apply -f konnectivity-agent-ds.yaml |
| 35 |
serviceaccount/konnectivity-agent created |
| 36 |
``` |
| 37 |
|
| 38 |
To validate that it works, run a custom image and get pod logs (it goes through the konnectivity proxy): |
| 39 |
```sh |
| 40 |
$ kubectl run test --image httpd:2 |
| 41 |
pod/test created |
| 42 |
$ kubectl get pods |
| 43 |
NAME READY STATUS RESTARTS AGE |
| 44 |
test 0/1 ContainerCreating 0 4s |
| 45 |
$ kubectl get pods |
| 46 |
NAME READY STATUS RESTARTS AGE |
| 47 |
test 1/1 Running 0 6s |
| 48 |
$ kubectl logs test |
| 49 |
... |
| 50 |
[Tue Apr 09 20:58:36.756720 2024] [mpm_event:notice] [pid 1:tid 139788897408896] AH00489: Apache/2.4.59 (Unix) configured -- resuming normal operations |
| 51 |
``` |