diff --git a/kubernetes/templates/cm-and-secrets/mysql-deploy.yml b/kubernetes/templates/cm-and-secrets/mysql-deploy.yml new file mode 100644 index 0000000..0fc0684 --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/mysql-deploy.yml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mysql +spec: + replicas: 1 + selector: + matchLabels: + app: mysql + template: + metadata: + labels: + app: mysql + spec: + containers: + - image: mysql:5.6 + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + value: "password-in-cleartext" + ports: + - name: mysql + containerPort: 3306 +# volumeMounts: +# - name: mysql-vol +# mountPath: /var/lib/mysql +# volumes: +# - name: mysql-vol +# hostPath: +# path: /var/mysql-data \ No newline at end of file diff --git a/kubernetes/templates/cm-and-secrets/mysql-secret.yml b/kubernetes/templates/cm-and-secrets/mysql-secret.yml new file mode 100644 index 0000000..4d94b28 --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/mysql-secret.yml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: mysql-secret +type: Opaque +stringData: + root-pass: test123 \ No newline at end of file diff --git a/kubernetes/templates/cm-and-secrets/nginx-http-cm.yml b/kubernetes/templates/cm-and-secrets/nginx-http-cm.yml new file mode 100644 index 0000000..ddeb53a --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/nginx-http-cm.yml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-http-cm +data: + nginx.conf: | + user nginx; + worker_processes 1; + events { + worker_connections 10240; + } + http { + server { + listen 80; + server_name _; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + } + } \ No newline at end of file diff --git a/kubernetes/templates/cm-and-secrets/nginx-http-deploy.yml b/kubernetes/templates/cm-and-secrets/nginx-http-deploy.yml new file mode 100644 index 0000000..6f57de3 --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/nginx-http-deploy.yml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-http +spec: + replicas: 1 + selector: + matchLabels: + app: nginx-http + template: + metadata: + labels: + app: nginx-http + spec: + containers: + - name: nginx-http + image: nginx + ports: + - name: web + containerPort: 80 + volumeMounts: + - name: nginx-http-cm + mountPath: /etc/nginx + - name: nginx-http-vol + mountPath: /usr/share/nginx/html + volumes: + - name: nginx-http-cm + configMap: + name: nginx-http-cm + - name: nginx-http-vol + hostPath: + path: /var/nginxserver \ No newline at end of file diff --git a/kubernetes/templates/cm-and-secrets/nginx-http-svc.yml b/kubernetes/templates/cm-and-secrets/nginx-http-svc.yml new file mode 100644 index 0000000..8f5a663 --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/nginx-http-svc.yml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-http-svc + labels: + app: nginx-http +spec: + type: LoadBalancer + ports: + - port: 30080 + targetPort: 80 + protocol: TCP + name: http + selector: + app: nginx-http \ No newline at end of file diff --git a/kubernetes/templates/cm-and-secrets/nginx-https-cm.yml b/kubernetes/templates/cm-and-secrets/nginx-https-cm.yml new file mode 100644 index 0000000..5f95e5f --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/nginx-https-cm.yml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-https-cm +data: + nginx.conf: | + user nginx; + worker_processes 1; + events { + worker_connections 10240; + } + http { + server { + listen 80; + listen 443 ssl; + + server_name _; + + ssl_certificate /etc/nginx/ssl/server-cert.pem; + ssl_certificate_key /etc/nginx/ssl/server-key.pem; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + } + } diff --git a/kubernetes/templates/cm-and-secrets/nginx-https-deploy.yml b/kubernetes/templates/cm-and-secrets/nginx-https-deploy.yml new file mode 100644 index 0000000..0a6330c --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/nginx-https-deploy.yml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-https +spec: + replicas: 1 + selector: + matchLabels: + app: nginx-https + template: + metadata: + labels: + app: nginx-https + spec: + containers: + - name: nginx-https + image: nginx + ports: + - name: secureweb + containerPort: 443 + volumeMounts: + - name: nginx-https-cm + mountPath: /etc/nginx + - name: nginx-https-secret + mountPath: /etc/nginx/ssl + readOnly: true + - name: nginx-https-vol + mountPath: /usr/share/nginx/html + volumes: + - name: nginx-https-cm + configMap: + name: nginx-https-cm + - name: nginx-https-secret + secret: + secretName: nginx-https-secret + - name: nginx-https-vol + hostPath: + path: /var/nginxserver \ No newline at end of file diff --git a/kubernetes/templates/cm-and-secrets/nginx-https-secret-blank.yml b/kubernetes/templates/cm-and-secrets/nginx-https-secret-blank.yml new file mode 100644 index 0000000..8f9047c --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/nginx-https-secret-blank.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: nginx-https-secret +type: Opaque +stringData: + server-cert.pem: | + -----BEGIN CERTIFICATE----- + ... + -----END CERTIFICATE----- + server-key.pem: | + \ No newline at end of file diff --git a/kubernetes/templates/cm-and-secrets/nginx-https-svc.yml b/kubernetes/templates/cm-and-secrets/nginx-https-svc.yml new file mode 100644 index 0000000..9660ae7 --- /dev/null +++ b/kubernetes/templates/cm-and-secrets/nginx-https-svc.yml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-https-svc + labels: + app: nginx-https +spec: + type: LoadBalancer + ports: + - port: 31080 + targetPort: 80 + protocol: TCP + name: http + - port: 31443 + targetPort: 443 + protocol: TCP + name: https + selector: + app: nginx-https \ No newline at end of file diff --git a/kubernetes/templates/pv-and-pvc/local-web.yml b/kubernetes/templates/pv-and-pvc/local-web.yml index 079dd5e..3980763 100644 --- a/kubernetes/templates/pv-and-pvc/local-web.yml +++ b/kubernetes/templates/pv-and-pvc/local-web.yml @@ -24,4 +24,4 @@ spec: volumes: - name: local hostPath: - path: /usr/share/nginx/html \ No newline at end of file + path: /var/nginxserver \ No newline at end of file