Добро пожаловать в Интернет без Nginx
++ +
+
+ + + +
diff --git a/Igor_Smirnov/1/Dockerfile b/Igor_Smirnov/1/Dockerfile new file mode 100644 index 0000000..14d2466 --- /dev/null +++ b/Igor_Smirnov/1/Dockerfile @@ -0,0 +1,2 @@ +FROM nginx +COPY ./files /usr/share/nginx/html diff --git a/Igor_Smirnov/1/deployment.yaml b/Igor_Smirnov/1/deployment.yaml new file mode 100644 index 0000000..cb43681 --- /dev/null +++ b/Igor_Smirnov/1/deployment.yaml @@ -0,0 +1,79 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-configmap +data: + nginx.conf: | + server { + listen 80; + location /nginx-blackout { + root /usr/share/nginx/html; + index blackout.html; + } + + location / { + if ($time_iso8601 ~ ^2020-01-05T00:[0-5][0-9]:[0-9][0-9]) { + return 302 /nginx-blackout; + } + root /usr/share/nginx/html; + index index.html; + } + } + +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: nginx-server + template: + metadata: + labels: + app: nginx-server + spec: + containers: + - name: nginx + image: smirnovigor077/nginx-hw1 + volumeMounts: + - name: nginx-config + mountPath: /etc/nginx/conf.d/ + volumes: + - name: nginx-config + configMap: + name: nginx-configmap + +--- + +apiVersion: v1 +kind: Service +metadata: + name: nginx-service +spec: + selector: + app: nginx-server + ports: + - port: 80 + targetPort: 80 + +--- + +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: nginx-ingress + annotations: + kubernetes.io/ingress.class: "nginx" +spec: + rules: + - host: localhst + http: + paths: + - path: / + backend: + serviceName: nginx-service + servicePort: 80 diff --git a/Igor_Smirnov/1/files/nginx-blackout/blackout.html b/Igor_Smirnov/1/files/nginx-blackout/blackout.html new file mode 100644 index 0000000..3f3b8c2 --- /dev/null +++ b/Igor_Smirnov/1/files/nginx-blackout/blackout.html @@ -0,0 +1,41 @@ + +
+