-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Kuber-2024-04OTUS/kubernetes-intro
homework 1
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: homework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |