Skip to content

Instantly share code, notes, and snippets.

@WalBeh
Last active June 16, 2021 11:53
Show Gist options
  • Select an option

  • Save WalBeh/49058f6c1fef37688a36b43600cfb3ed to your computer and use it in GitHub Desktop.

Select an option

Save WalBeh/49058f6c1fef37688a36b43600cfb3ed to your computer and use it in GitHub Desktop.

Setup microk8s

Following the instructions from https://microk8s.io/docs

sudo snap install microk8s --classic --channel=1.21

sudo usermod -a -G microk8s $USER  
sudo chown -f -R $USER ~/.kube

microk8s status --wait-ready
microk8s kubectl get nodes

alias kubectl='microk8s kubectl'


microk8s enable dns storage

DNS, right :-) --- /etc/hosts

This will do it, for our test setup.

68.183.5.88 ub12
178.62.239.7 ub11
188.166.9.90 ub10

Join Nodes to cluster

root@ub11:~# microk8s join 188.166.9.90:25000/d89d2c66f52d0f67687275b7a925cc45/cc292e6526b3
Contacting cluster at 188.166.9.90
Waiting for this node to finish joining the cluster. ..


Storage: Longhorn (we do not support this, demonstration only)

Following https://longhorn.io/docs/1.1.1/deploy/install/install-with-kubectl/

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.1.1/deploy/longhorn.yaml

-or- and search for k3s

wget https://raw.githubusercontent.com/longhorn/longhorn/v1.1.1/deploy/longhorn.yaml > lh.yaml
vi lh.yaml

Fix Need to specify \"--kubelet-root-dir\"

 k8 -n longhorn-system edit deployment longhorn-driver-deployer
      - name: KUBELET_ROOT_DIR
        value: /var/snap/microk8s/common/var/lib/kubelet

Longhorn Ingress (just for demo)

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: longhorn-ingress
  namespace: longhorn-system
spec:
  rules:
  - host: longhorn.cratedb-edge-proxy-dev.net
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: longhorn-frontend
            port:
              number: 80

THE console.cratedb-dev.cloud

https://console.cratedb-dev.cloud/ and create you egde-region (right now the argo tunnels and CNAMEs need to be created manually. Juan is already on this one.)

apt install jq

cat /usr/local/bin/kubectl   
#!/usr/bin/env bash
microk8s kubectl $@

chmod +x /usr/local/bin/kubectl   


bash <(wget -qO- https://console.cratedb-dev.cloud/edge/cratedb-cloud-edge.sh) ....

-or-

wget -qO- https://console.cratedb-dev.cloud/edge/cratedb-cloud-edge.sh > edge-installer.sh
chmod u+x edge-installer.sh
./edge-installer --dry-run  <token>

Note: dry-run downloads the yamls that are going to be applied. Check them!!!!

i-rw-r--r--  1 root root 93636 May 28 14:24 edge-manifest.yaml

kubernetes dashboard

https://microk8s.io/docs/addon-dashboard

microk8s enable dashboard
microk8s kubectl edit  -n kube-system service/kubernetes-dashboard (change PORT to 8443)
ssh -i ~/.ssh/id_ed25519 root@64.227.77.29 -L 10443:localhost:10443

token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
microk8s kubectl -n kube-system describe secret $token


kubectl setup

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
echo "$(<kubectl.sha256) kubectl" | sha256sum --check

alias k=kubectl
complete -F __start_kubectl k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment