Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lesson 5 #123

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions homework/5.kubernetes-network/postgres/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-dep
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- image: postgres:10.13
name: postgres
ports:
- containerPort: 5432
protocol: TCP
env:
- name: POSTGRES_USER
value: testuser
- name: POSTGRES_DB
value: testdatabase
- name: PGDATA
value: var/lib/postgresql/data/pgdata
envFrom:
- secretRef:
name: userpass
volumeMounts:
- name: pvc
mountPath: /var/lib/postgresql/data
volumes:
- name: pvc
persistentVolumeClaim:
claimName: mystorage
18 changes: 18 additions & 0 deletions homework/5.kubernetes-network/postgres/net-tool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: net-tool
spec:
replicas: 1
selector:
matchLabels:
app: net-tool
template:
metadata:
labels:
app: net-tool
spec:
containers:
- image: nginx:1.20
name: nginx
12 changes: 12 additions & 0 deletions homework/5.kubernetes-network/postgres/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mystorage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: csi-ceph-hdd-gz1-retain
6 changes: 6 additions & 0 deletions homework/5.kubernetes-network/postgres/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Secret
metadata:
name: userpass
data:
POSTGRES_PASSWORD: dGVzdHBhc3N3b3Jk
12 changes: 12 additions & 0 deletions homework/5.kubernetes-network/postgres/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: Service
metadata:
name: database
spec:
ports:
- port: 5432
targetPort: 5432
selector:
app: my-app
type: ClusterIP
33 changes: 33 additions & 0 deletions homework/5.kubernetes-network/redmine/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-dep-redmine
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: my-app-redmine
template:
metadata:
labels:
app: my-app-redmine
spec:
containers:
- image: redmine:4.1.1
name: redmine
ports:
- containerPort: 3000
protocol: TCP
env:
- name: REDMINE_DB_POSTGRES
value: database
- name: REDMINE_DB_USERNAME
value: testuser
- name: REDMINE_DB_DATABASE
value: testdatabase
envFrom:
- secretRef:
name: userpassredmine
11 changes: 11 additions & 0 deletions homework/5.kubernetes-network/redmine/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
spec:
defaultBackend:
service:
name: redmine-service
port:
number: 3000
11 changes: 11 additions & 0 deletions homework/5.kubernetes-network/redmine/ingressclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
labels:
app.kubernetes.io/component: controller
name: nginx-example
annotations:
ingressclass.kubernetes.io/is-default-class: "true"
spec:
controller: k8s.io/ingress-nginx
7 changes: 7 additions & 0 deletions homework/5.kubernetes-network/redmine/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: userpassredmine
data:
REDMINE_DB_PASSWORD: dGVzdHBhc3N3b3Jk
REDMINE_SECRET_KEY_BASE: c3VwZXJzZWNyZXRrZXkK
12 changes: 12 additions & 0 deletions homework/5.kubernetes-network/redmine/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: Service
metadata:
name: redmine-service
spec:
ports:
- port: 3000
targetPort: 3000
selector:
app: my-app-redmine
type: ClusterIP