# kubectl

sudo snap install kubectl --classic

microk8s.kubectl config view --raw &gt; <span class="hljs-variable">$HOME</span>/.kube/microk8s.config

<span class="hljs-meta">\# add the minik8s cluster to kubectl</span>

<s>-kubectl config set-cluster microk8s-cluster --server=http:<span class="hljs-comment">//127.0.0.1:8080 --insecure-skip-tls-verify</span> </s>

<span class="hljs-comment">ich habe stattdessen </span>

```
microk8s.kubectl config view --raw > $HOME/.kube/config
```

<span class="hljs-comment"> verwendet</span>

<span class="hljs-meta">\# create the microk8s context</span>

```
kubectl config set-context microk8s --user=admin --cluster=microk8s-cluster
```

<span class="hljs-meta">\# switch to the microk8s context</span>

```
kubectl config use-context microk8s
```

die Datei auf einem externen Rechner kopieren:

```
scp USERNAME@HOST:/home/USERNAME/.kube/config config
```