Skip to content

Instantly share code, notes, and snippets.

@hugosantos
Last active June 16, 2023 23:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugosantos/dca5f1906691874a48fd66c3e491523c to your computer and use it in GitHub Desktop.
Save hugosantos/dca5f1906691874a48fd66c3e491523c to your computer and use it in GitHub Desktop.
Running arbitrary k3s in a Namespace VM
# To try this out, first download our cli and login:
curl -fsSL https://get.namespace.so/cloud/install.sh | sh
nsc login
# --bare tell us to start a cluster without kubernetes already
nsc create --bare --experimental '{"tls_backed_ports":[{"name":"k3s", "port":6443}]}'
> Created new ephemeral environment! ID: u09d554ivoika
>
> More at: https://cloud.namespace.so/01gr490qvbntkjn9jwypnd4g04/cluster/u09d554ivoika
>
> (Experimental) TLS backend ports:
> k3s-u09d554ivoika.int-fra1.nscluster.cloud:4443 (k3s/6443)
Then run:
nsc ssh u09d554ivoika
And:
curl -Lo /usr/local/bin/k3s https://github.com/k3s-io/k3s/releases/download/v1.26.5+k3s1/k3s; chmod a+x /usr/local/bin/k3s
# Using docker but can also connect to the VM's containerd.
k3s server --docker -d /root/k3s -l k3s.log
In another terminal:
nsc ssh u09d554ivoika cat /etc/rancher/k3s/k3s.yaml | sed 's/127.0.0.1:6443/k3s-u09d554ivoika.int-fra1.nscluster.cloud:4443/' > k3s.yaml
KUBECONFIG=k3s.yaml kubectl get pod -A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment