Skip to content

Commit

Permalink
ДЗ#3
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfvyf committed Jul 14, 2024
1 parent 5f94409 commit 306bf4d
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 0 deletions.
20 changes: 20 additions & 0 deletions kubernetes-volumes/cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
namespace: homework
data:
nginx.conf: |
server {
listen 8000;
root /homework;
autoindex on;
}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: my-configmap
namespace: homework
data:
test: "123"
65 changes: 65 additions & 0 deletions kubernetes-volumes/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:stable
ports:
- containerPort: 8000
volumeMounts:
- mountPath: /homework
name: html
- mountPath: /etc/nginx/conf.d/
name: nginx-conf
- mountPath: /homework/conf
name: my-configmap
lifecycle:
preStop:
exec:
command:
- "rm"
- "/homework/index.html"
readinessProbe:
httpGet:
path: /index.html
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
initContainers:
- name: install
image: busybox:stable
command:
- wget
- "-O"
- "/init/index.html"
- http://github.com
volumeMounts:
- name: html
mountPath: "/init"
volumes:
- name: nginx-conf
configMap:
name: nginx-conf
- name: my-configmap
configMap:
name: my-configmap
- name: html
persistentVolumeClaim:
claimName: nginx-html-pvc
26 changes: 26 additions & 0 deletions kubernetes-volumes/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
namespace: homework
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: homework.otus
http:
paths:
- path: /homepage
pathType: Prefix
backend:
service:
name: nginx-service
port:
number: 8000
- path: /(.*)
pathType: ImplementationSpecific
backend:
service:
name: nginx-service
port:
number: 8000
4 changes: 4 additions & 0 deletions kubernetes-volumes/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: homework
12 changes: 12 additions & 0 deletions kubernetes-volumes/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nginx-html-pvc
namespace: homework
spec:
storageClassName: custom-sc
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
8 changes: 8 additions & 0 deletions kubernetes-volumes/sc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: custom-sc
namespace: homework
provisioner: k8s.io/minikube-hostpath
reclaimPolicy: Retain
volumeBindingMode: Immediate
10 changes: 10 additions & 0 deletions kubernetes-volumes/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
ports:
- port: 8000
targetPort: 8000
selector:
app: nginx

0 comments on commit 306bf4d

Please sign in to comment.