Skip to content

Commit

Permalink
Merge pull request #1 from Kuber-2024-04OTUS/kubernetes-intro
Browse files Browse the repository at this point in the history
homework 1
  • Loading branch information
alexeev79 authored May 14, 2024
2 parents 5263f1d + 5e8a2f1 commit 36924ed
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
34 changes: 34 additions & 0 deletions kubernetes-intro/configmap-nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
namespace: homework
data:
default.conf: |
server {
listen 8000;
listen [::]:8000;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /homework;
index index.php; #костыль, чтобы отображалось содержимое директории, даже если в ней есть файл index.html
autoindex on;
autoindex_localtime on;
autoindex_exact_size off;
charset utf-8;
}
# error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
4 changes: 4 additions & 0 deletions kubernetes-intro/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: homework
33 changes: 33 additions & 0 deletions kubernetes-intro/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: homework
spec:
initContainers:
- name: init-container
image: busybox:1.36.1
command: ["/bin/sh", "-c", "echo Hello, world! > /init/index.html"]
volumeMounts:
- name: shared-data
mountPath: /init
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 8000
volumeMounts:
- name: shared-data
mountPath: /homework
- name: nginx-conf
mountPath: /etc/nginx/conf.d
lifecycle:
preStop:
exec:
command: ["rm", "-f", "/homework/index.html"]
volumes:
- name: shared-data
emptyDir: {}
- name: nginx-conf
configMap:
name: nginx-conf

0 comments on commit 36924ed

Please sign in to comment.