Microk8s

From Essential
Revision as of 17:28, 11 February 2023 by Tcepo (talk | contribs)
Jump to navigation Jump to search

AUTOMATED INSTALL

  • Execute :
mkdir -p ~/old &&\
cd ~/old &&\
curl https://infocepo.com/wiki/index.php/Special:Export/Microk8s 2>/dev/null |tac |sed -r '0,/'"#"'24cc42#/d' |tac |sed -r '0,/'"#"'24cc42#/d' |sed 's/'"&"'amp;/\&/g;s/'"&"'gt;/>/g;s/'"&"'lt;/</g' >$$ &&\
bash $$ &&\
cd -

code

#24cc42#
#https://kubernetes.io/blog/2019/11/26/running-kubernetes-locally-on-linux-with-microk8s/
dhcpList=192.168.1.21-192.168.1.29

snap install microk8s --classic
#microk8s.start
#watch microk8s status
microk8s enable helm3 dns community hostpath-storage ingress
#microk8s disable metallb
microk8s enable metallb:${dhcpList}
#snap alias microk8s.kubectl kubectl
snap install kubectl --classic
snap alias microk8s.helm3 helm
#snap unalias
#24cc42#

FIRST APP

kubectl create namespace sandbox
kubectl config set-context --current --namespace=sandbox
#kubectl delete deployment sandbox
kubectl create deployment sandbox --image=registry.k8s.io/e2e-test-images/agnhost:2.39 -- /agnhost netexec --http-port=8080
#kubectl delete svc sandbox
kubectl expose deployment sandbox --type=LoadBalancer --port=8080
kubectl delete ingress sandbox
cat <<EOF |kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sandbox
spec:
  rules:
  - host: "sandbox.c1.mi.infocepo.com"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: sandbox
            port:
              number: 8080
EOF