Erste Demo
Wir verwenden diese Demo später um ein Letsencrypt Zertifikat für das Backend zu holen
HTTPD Image
Deploy Demo Http App Zugriff über Ingress
#create deployment kubectl create deployment demo --image=httpd --port=80 #expose as service kubectl expose deployment demo #create ingress kubectl create ingress demo-localhost --class=public --annotation=nginx.ingress.kubernetes.io/rewrite-target=/$1 --rule=kimo2007.dnshome.de/demo/*=demo:80,tls=letsencrypt-tls --default-backend=demo:80 -n dev
deployment.yaml
apiVersion: apps/v1 kind: Deployment metadata: name: demo spec: replicas: 1 selector: matchLabels: app: demo template: metadata: labels: app: demo spec: containers: - name: demo image: httpd ports: - containerPort: 80 imagePullPolicy: Never
service.yaml
apiVersion: v1 kind: Service metadata: labels: app: demo name: demo-service spec: externalTrafficPolicy: Cluster ports: - port: 80 targetPort: 80 selector: app: demo type: LoadBalancer
ingress.yaml
kind: Ingress apiVersion: networking.k8s.io/v1 metadata: annotations: nginx.ingress.kubernetes.io/rewrite-target: /$2 name: demo-localhost spec: ingressClassName: public rules: - host: kimo2007.dnshome.de http: paths: - path: /demo(/|$)(.*) pathType: Prefix backend: service: name: demo-service port: number: 80
Deploy via Helm3
microk8s helm3 install demo ./k8s --set defaultBackend.enabled=false,controller.defaultBackendService=demo-service -n dev microk8s helm3 uninstall demo -n dev