From b4a9b30a3facddc80687f6ea6306cc364baa3f0a Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 19 May 2019 13:37:13 +0200 Subject: [PATCH] staticpage exmpl --- README.md | 20 +++++++++++++++++-- staticpage-ingress-ssl.yaml | 37 ++++++++++++++++++++++++++++++++++ staticpage-ingress.yaml | 27 +++++++++++++++++++++++++ staticpage.yaml | 40 +++++++++++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 staticpage-ingress-ssl.yaml create mode 100644 staticpage-ingress.yaml create mode 100644 staticpage.yaml diff --git a/README.md b/README.md index daf370d..caf36db 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-da scp haproxy.conf root@ssh root@$(hetzner-kube cluster master-ip k8s-test): ssh root@$(hetzner-kube cluster master-ip k8s-test) - apt install haproxy - mv haproxy.conf /etc/haproxy/haproxy.cfg + apt install -y haproxy + mv haproxy.cfg /etc/haproxy/haproxy.cfg systemctl restart haproxy ### frontend LB variante 2 @@ -66,6 +66,22 @@ http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-da ssh root@$(hetzner-kube cluster master-ip k8s-test) apt install -y python ansible-playbook -i "$(hetzner-kube cluster master-ip k8s-test)," -u root ansible-haproxy.yaml +## static page + + kubectl apply -f staticpage.yaml + kubectl proxy + http://localhost:8001/api/v1/namespaces/testsite/pods/http:static-nginx:/proxy/#! + +### add ingress + + kubectl apply -f staticpage-ingress.yaml + +## set up SSL + +### add ssl to testsite + + kubectl apply -f staticpage-ingress-ssl.yaml + ## test deployment helm install --namespace k8spress --name wordpress -f helm-wordpress.yaml stable/wordpress diff --git a/staticpage-ingress-ssl.yaml b/staticpage-ingress-ssl.yaml new file mode 100644 index 0000000..c27b8c6 --- /dev/null +++ b/staticpage-ingress-ssl.yaml @@ -0,0 +1,37 @@ +apiVersion: v1 +kind: Service +metadata: + name: web-service + namespace: testsite +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 80 + name: http + selector: + app: web-backend +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: testsite-ingress + namespace: testsite + annotations: + kubernetes.io/ingress.class: "nginx" + certmanager.k8s.io/cluster-issuer: letsencrypt-staging + certmanager.k8s.io/acme-challenge-type: http01 +spec: + rules: + - host: test.k.zknt.org + http: + paths: + - backend: + serviceName: web-service + servicePort: 80 + path: / + + tls: + - hosts: + - test.k.zknt.org + secretName: testsite-certificate diff --git a/staticpage-ingress.yaml b/staticpage-ingress.yaml new file mode 100644 index 0000000..511270b --- /dev/null +++ b/staticpage-ingress.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: Service +metadata: + name: web-service + namespace: testsite +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 80 + selector: + app: web-backend +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: testsite-ingress + namespace: testsite +spec: + rules: + - host: test.k.zknt.org + http: + paths: + - backend: + serviceName: web-service + servicePort: 80 + path: / diff --git a/staticpage.yaml b/staticpage.yaml new file mode 100644 index 0000000..a0d853c --- /dev/null +++ b/staticpage.yaml @@ -0,0 +1,40 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: testsite +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: webdir + namespace: testsite +data: + index.html: | + + + Blank page + + + Nothing here to see. + + +--- +apiVersion: v1 +kind: Pod +metadata: + name: static-nginx + namespace: testsite + labels: + app: web-backend +spec: + containers: + - name: webserver + image: nginx:alpine + volumeMounts: + - name: webdir + mountPath: /usr/share/nginx/html + volumes: + - name: webdir + configMap: + name: webdir +