sudo snap install microk8s --classicsudo usermod -a -G microk8s $USER
newgrp microk8smicrok8s status --wait-readyalias mkctl="microk8s kubectl"Note
Its recommended to enable the features one by one, this way you can troubleshoot any issues that may arise.
microk8s enable dns
microk8s enable dashboard
microk8s enable ingress
microk8s enable cert-managernano addon_letsencrypt_cluster.ymlapiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
email: [email protected] # Replace with your email
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- http01:
ingress:
class: publicmkctl apply -f addon_letsencrypt_cluster.ymlmkctl get clusterissuer -o widemkctl apply -f express-api-nginx-ingress.yml # With cert-manager
#or
mkctl apply -f express-api2-nginx-ingress.yml # Without cert-managermkctl get pods -o widehttp://<hostname>mkctl config > configscp config $USER@$HOSTNAME:~/.kube/confignano ~/.kube/config
# find this line
server: https://<ip>:16443
# replace it with
server: https://<public-ip>:16443kubectl get pods -o wideNote
If you get an error about accessing the cluster, because your IP is not whitelisted, you can try the following:
sudo nano /var/snap/microk8s/current/certs/csr.conf.templateIP.1=<your-ip> # Continue adding your IP until you reach the last IPmicrok8s stop
microk8s startopenssl x509 -in /var/snap/microk8s/current/certs/server.crt -noout -text | grep "IP Address"
# you should see your IP in the output