Skip to content

Instantly share code, notes, and snippets.

@itomten
Last active October 2, 2022 18:34
Show Gist options
  • Save itomten/ac3f528595ec45ab7be3c09add6ea421 to your computer and use it in GitHub Desktop.
Save itomten/ac3f528595ec45ab7be3c09add6ea421 to your computer and use it in GitHub Desktop.
Linux
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/bin/install > install
fish install
chsh -s /usr/bin/fish
#install k8
sudo snap install microk8s --classic --channel=1.25
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
su - $USER
#addons
microk8s enable dns dashboard storage
#expose dashboard
microk8s kubectl -n kube-system edit service kubernetes-dashboard
#edit dashboard service and change service “type” from ClusterIP to NodePort
#görs i vi (navigera med pilar, tryck x för att ta bort bokstäver, tryck i för skriva NodePort, tryck :wq spara o sluta)
#Kolla vilken port
microk8s kubectl -n kube-system get services
#surfa till ip på host med port ovan
#detta vet jag inte vad det gör...
lsof -i tcp:port från ovan
#get token dashboard
token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
microk8s kubectl -n kube-system describe secret $token
# accessing services
microk8s status
microk8s kubectl get all --all-namespaces
microk8s kubectl get nodes
microk8s kubectl get services
#deploy exempel:
microk8s kubectl create deployment microbot --image=dontrebootme/microbot:v1
microk8s kubectl scale deployment microbot --replicas=2
#ovan hämtar från docker repo, andra raden anger hur många instanser
microk8s kubectl expose deployment microbot --type=NodePort --port=80 --name=microbot-service
#ovan öppnar port utåt
microk8s status: Provides an overview of the MicroK8s state (running / not running) as well as the set of enabled addons
microk8s enable: Enables an addon
microk8s disable: Disables an addon
microk8s kubectl: Interact with kubernetes
microk8s config: Shows the kubernetes config file
microk8s istioctl: Interact with the istio services; needs the istio addon to be enabled
microk8s inspect: Performs a quick inspection of the MicroK8s intallation
microk8s reset: Resets the infrastructure to a clean state
microk8s stop: Stops all kubernetes services
microk8s start: Starts MicroK8s after it is being stopped
Add neofetch to fish
~/.config/fish/config.fish
Lägg till neofetch sist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment