新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
59
learn/learn-kubernetes-master/kiamol/ch15/todo-list/db.yaml
Normal file
59
learn/learn-kubernetes-master/kiamol/ch15/todo-list/db.yaml
Normal file
@@ -0,0 +1,59 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: todo-db
|
||||
labels:
|
||||
kiamol: ch15
|
||||
spec:
|
||||
ports:
|
||||
- port: 5432
|
||||
targetPort: 5432
|
||||
selector:
|
||||
app: todo-db
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: todo-db-secret
|
||||
labels:
|
||||
kiamol: ch15
|
||||
type: Opaque
|
||||
stringData:
|
||||
POSTGRES_PASSWORD: "kiamol-2*2*"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: todo-db
|
||||
labels:
|
||||
kiamol: ch15
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: todo-db
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: todo-db
|
||||
spec:
|
||||
containers:
|
||||
- name: db
|
||||
image: postgres:11.6-alpine
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD_FILE
|
||||
value: /secrets/postgres_password
|
||||
volumeMounts:
|
||||
- name: secret
|
||||
mountPath: "/secrets"
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
volumes:
|
||||
- name: secret
|
||||
secret:
|
||||
secretName: todo-db-secret
|
||||
defaultMode: 0400
|
||||
items:
|
||||
- key: POSTGRES_PASSWORD
|
||||
path: postgres_password
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo
|
||||
labels:
|
||||
kiamol: ch15
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
@@ -0,0 +1,31 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo
|
||||
labels:
|
||||
kiamol: ch15
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- pathType: Exact
|
||||
path: /
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- pathType: Exact
|
||||
path: /list
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- pathType: Exact
|
||||
path: /new
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- pathType: Prefix
|
||||
path: /static
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
@@ -0,0 +1,69 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo-new
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/affinity: cookie
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- pathType: Exact
|
||||
path: /new
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
tls:
|
||||
- secretName: kiamol-cert
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo-static
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-buffering: "on"
|
||||
nginx.ingress.kubernetes.io/configuration-snippet: |
|
||||
proxy_cache static-cache;
|
||||
proxy_cache_valid 60m;
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: /static
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
tls:
|
||||
- secretName: kiamol-cert
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo
|
||||
labels:
|
||||
kiamol: ch15
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- pathType: Exact
|
||||
path: /
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- pathType: Exact
|
||||
path: /list
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
tls:
|
||||
- secretName: kiamol-cert
|
||||
@@ -0,0 +1,57 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo-new
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/affinity: cookie
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- pathType: Exact
|
||||
path: /new
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo-static
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-buffering: "on"
|
||||
nginx.ingress.kubernetes.io/configuration-snippet: |
|
||||
proxy_cache static-cache;
|
||||
proxy_cache_valid 60m;
|
||||
add_header X-Cache $upstream_cache_status;
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: /static
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo
|
||||
spec:
|
||||
rules:
|
||||
- host: todo.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- pathType: Exact
|
||||
path: /
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- pathType: Exact
|
||||
path: /list
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
@@ -0,0 +1,66 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2-new
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: Path
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
traefik.ingress.kubernetes.io/router.tls.certresolver: default
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /new
|
||||
backend:
|
||||
serviceName: todo-web-sticky
|
||||
servicePort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2-static
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: PathPrefix
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
traefik.ingress.kubernetes.io/router.tls.certresolver: default
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /static
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: Path
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
traefik.ingress.kubernetes.io/router.tls.certresolver: default
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- path: /list
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
@@ -0,0 +1,69 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2-new
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: Path
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /new
|
||||
backend:
|
||||
serviceName: todo-web-sticky
|
||||
servicePort: 80
|
||||
tls:
|
||||
- secretName: kiamol-cert
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2-static
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: PathPrefix
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /static
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
tls:
|
||||
- secretName: kiamol-cert
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: Path
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- path: /list
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
tls:
|
||||
- secretName: kiamol-cert
|
||||
@@ -0,0 +1,76 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: todo-web-sticky
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/service.sticky.cookie: "true"
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: todo-web
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2-new
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: Path
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /new
|
||||
backend:
|
||||
serviceName: todo-web-sticky
|
||||
servicePort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2-static
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: PathPrefix
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /static
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: todo2
|
||||
labels:
|
||||
kiamol: ch15
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: traefik
|
||||
traefik.ingress.kubernetes.io/router.pathmatcher: Path
|
||||
spec:
|
||||
rules:
|
||||
- host: todo2.kiamol.local
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
- path: /list
|
||||
backend:
|
||||
serviceName: todo-web
|
||||
servicePort: 80
|
||||
81
learn/learn-kubernetes-master/kiamol/ch15/todo-list/web.yaml
Normal file
81
learn/learn-kubernetes-master/kiamol/ch15/todo-list/web.yaml
Normal file
@@ -0,0 +1,81 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: todo-web
|
||||
labels:
|
||||
kiamol: ch15
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: todo-web
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: todo-web-config
|
||||
labels:
|
||||
kiamol: ch15
|
||||
data:
|
||||
config.json: |-
|
||||
{
|
||||
"ConfigController": {
|
||||
"Enabled" : true
|
||||
},
|
||||
"Database" : {
|
||||
"Provider" : "Postgres"
|
||||
},
|
||||
"Metrics" : {
|
||||
"Enabled" : true
|
||||
}
|
||||
}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: todo-web-secret
|
||||
labels:
|
||||
kiamol: ch15
|
||||
type: Opaque
|
||||
stringData:
|
||||
secrets.json: |-
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"ToDoDb": "Server=todo-db;Database=todo;User Id=postgres;Password=kiamol-2*2*;"
|
||||
}
|
||||
}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: todo-web
|
||||
labels:
|
||||
kiamol: ch15
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: todo-web
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: todo-web
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: kiamol/ch04-todo-list
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: "/app/config"
|
||||
readOnly: true
|
||||
- name: secret
|
||||
mountPath: "/app/secrets"
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: todo-web-config
|
||||
- name: secret
|
||||
secret:
|
||||
secretName: todo-web-secret
|
||||
defaultMode: 0400
|
||||
Reference in New Issue
Block a user