# Get the cluster subnet and set up firewalld SUBNET=$(grep CALICO_IPV4POOL_CIDR -a1 /var/snap/microk8s/current/args/cni-network/cni.yaml | tail -n1 | grep -oP '[\d\./]+') sudo firewall-cmd --permanent --new-zone=microk8s-cluster sudo firewall-cmd --permanent --zone=microk8s-cluster --set-target=ACCEPT sudo firewall-cmd --permanent --zone=microk8s-cluster --add-source="$SUBNET" sudo firewall-cmd --reload
sudo microk8s.kubectl wait pods -n kube-system -l k8s-app=calico-node --for condition=Ready --timeout=180s
# Get DNS servers DNS_SERVERS=$(grep '^nameserver' /etc/resolv.conf | awk '{print $2}' | tr '\n' ',' | sed 's/,$//') sudo microk8s enable core/dns:"$DNS_SERVERS"
sudo microk8s.kubectl wait deployment -n kube-system coredns --for condition=Available=True --timeout=180s
sudo microk8s enable rbac
sudo microk8s enable metrics-server
sudo microk8s enable ingress
sudo microk8s.kubectl patch -n ingress configmap nginx-load-balancer-microk8s-conf -p '{"data": { "global-allowed-response-headers": "Cache-Control,Pragma,Expires,X-Frame-Options,X-XSS-Protection,X-Content-Type-Options,Strict-Transport-Security,Content-Security-Policy" } }'