diff --git a/nginx/deployment.yaml b/nginx/k8s/01_deployment.yaml similarity index 68% rename from nginx/deployment.yaml rename to nginx/k8s/01_deployment.yaml index 303e401..8bca8b9 100644 --- a/nginx/deployment.yaml +++ b/nginx/k8s/01_deployment.yaml @@ -19,3 +19,10 @@ spec: image: nginx:1.14.2 ports: - containerPort: 80 + resources: + requests: + memory: "32Mi" + cpu: 128m + limits: + memory: "64Mi" + cpu: 256m diff --git a/nginx/service.yaml b/nginx/k8s/02_service.yaml similarity index 67% rename from nginx/service.yaml rename to nginx/k8s/02_service.yaml index 241de6a..0f6c205 100644 --- a/nginx/service.yaml +++ b/nginx/k8s/02_service.yaml @@ -7,6 +7,6 @@ spec: selector: app: nginx ports: - - protocol: TCP - port: 8000 - targetPort: 80 \ No newline at end of file + - protocol: TCP + port: 8000 + targetPort: 80 \ No newline at end of file diff --git a/nginx/ingress.yml b/nginx/k8s/03_ingress.yml similarity index 100% rename from nginx/ingress.yml rename to nginx/k8s/03_ingress.yml diff --git a/nginx/kustomize/base/deployment.yaml b/nginx/kustomize/base/deployment.yaml new file mode 100644 index 0000000..b3f660c --- /dev/null +++ b/nginx/kustomize/base/deployment.yaml @@ -0,0 +1,21 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: app-deployment +spec: + replicas: 1 + selector: + template: + spec: + containers: + - name: nginx + image: nginx + ports: + - containerPort: 80 + resources: + requests: + memory: "32Mi" + cpu: 128m + limits: + memory: "64Mi" + cpu: 256m diff --git a/nginx/kustomize/base/kustomization.yaml b/nginx/kustomize/base/kustomization.yaml new file mode 100644 index 0000000..a944d00 --- /dev/null +++ b/nginx/kustomize/base/kustomization.yaml @@ -0,0 +1,3 @@ +resources: +- deployment.yaml +- service.yaml diff --git a/nginx/kustomize/base/service.yaml b/nginx/kustomize/base/service.yaml new file mode 100644 index 0000000..429a0a7 --- /dev/null +++ b/nginx/kustomize/base/service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: app-service +spec: + type: ClusterIP + ports: + - protocol: TCP + port: 8000 + targetPort: 80 \ No newline at end of file diff --git a/nginx/kustomize/overlays/default/ingress.yaml b/nginx/kustomize/overlays/default/ingress.yaml new file mode 100644 index 0000000..89c2c78 --- /dev/null +++ b/nginx/kustomize/overlays/default/ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: app-ingress + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + ingressClassName: nginx + rules: + - http: + paths: + - path: /nginx + pathType: Prefix + backend: + service: + name: app-service + port: + number: 8000 \ No newline at end of file diff --git a/nginx/kustomize/overlays/default/kustomization.yaml b/nginx/kustomize/overlays/default/kustomization.yaml new file mode 100644 index 0000000..a6c23d1 --- /dev/null +++ b/nginx/kustomize/overlays/default/kustomization.yaml @@ -0,0 +1,23 @@ +resources: +- ../../base +- ingress.yaml + +namespace: default + +labels: +- includeSelectors: true + pairs: + app: nginx + +commonAnnotations: + owner: florian + +namePrefix: nginx- + +images: +- name: nginx + newName: nginx + newTag: 1.14.2 + +patches: +- path: replica.yaml \ No newline at end of file diff --git a/nginx/kustomize/overlays/default/replica.yaml b/nginx/kustomize/overlays/default/replica.yaml new file mode 100644 index 0000000..a4983aa --- /dev/null +++ b/nginx/kustomize/overlays/default/replica.yaml @@ -0,0 +1,6 @@ +kind: Deployment +apiVersion: apps/v1 +metadata: + name: app-deployment +spec: + replicas: 2 \ No newline at end of file