新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: timecheck-config
|
||||
data:
|
||||
appsettings.json: |-
|
||||
{
|
||||
"Application": {
|
||||
"Version": "1.1",
|
||||
"Environment": "TEST"
|
||||
},
|
||||
"Timer": {
|
||||
"IntervalSeconds": "7"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: timecheck
|
||||
labels:
|
||||
kiamol: ch07
|
||||
spec:
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
name: healthz
|
||||
- port: 8081
|
||||
targetPort: 8081
|
||||
name: metrics
|
||||
selector:
|
||||
app: timecheck
|
||||
type: ClusterIP
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: timecheck
|
||||
labels:
|
||||
kiamol: ch07
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: timecheck
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: timecheck
|
||||
version: v4
|
||||
spec:
|
||||
initContainers:
|
||||
- name: init-config
|
||||
image: kiamol/ch03-sleep
|
||||
command: ['sh', '-c', 'cp /config-in/appsettings.json /config-out/appsettings.json']
|
||||
volumeMounts:
|
||||
- name: config-map
|
||||
mountPath: /config-in
|
||||
- name: config-dir
|
||||
mountPath: /config-out
|
||||
containers:
|
||||
- name: timecheck
|
||||
image: kiamol/ch07-timecheck
|
||||
volumeMounts:
|
||||
- name: config-dir
|
||||
mountPath: /config
|
||||
readOnly: true
|
||||
- name: logs-dir
|
||||
mountPath: /logs
|
||||
- name: logger
|
||||
image: kiamol/ch03-sleep
|
||||
command: ['sh', '-c', 'tail -f /logs-ro/timecheck.log']
|
||||
volumeMounts:
|
||||
- name: logs-dir
|
||||
mountPath: /logs-ro
|
||||
readOnly: true
|
||||
- name: healthz
|
||||
image: kiamol/ch03-sleep
|
||||
command: ['sh', '-c', "while true; do echo -e 'HTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 17\n\n{\"status\": \"OK\"}' | nc -l -p 8080; done"]
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
- name: metrics
|
||||
image: kiamol/ch03-sleep
|
||||
command: ['sh', '-c', "while true; do echo -e 'HTTP/1.1 200 OK\nContent-Type: text/plain\nContent-Length: 104\n\n# HELP timechecks_total The total number timechecks.\n# TYPE timechecks_total counter\ntimechecks_total 6' | nc -l -p 8081; done"]
|
||||
ports:
|
||||
- containerPort: 8081
|
||||
name: http
|
||||
volumes:
|
||||
- name: config-map
|
||||
configMap:
|
||||
name: timecheck-config
|
||||
- name: config-dir
|
||||
emptyDir: {}
|
||||
- name: logs-dir
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,41 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: timecheck
|
||||
labels:
|
||||
kiamol: ch07
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: timecheck
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: timecheck
|
||||
version: v2
|
||||
spec:
|
||||
initContainers:
|
||||
- name: init-config
|
||||
image: kiamol/ch03-sleep
|
||||
command: ['sh', '-c', "cat /config-in/appsettings.json | jq --arg APP_ENV \"$APP_ENVIRONMENT\" '.Application.Environment=$APP_ENV' > /config-out/appsettings.json"]
|
||||
env:
|
||||
- name: APP_ENVIRONMENT
|
||||
value: TEST
|
||||
volumeMounts:
|
||||
- name: config-map
|
||||
mountPath: /config-in
|
||||
- name: config-dir
|
||||
mountPath: /config-out
|
||||
containers:
|
||||
- name: timecheck
|
||||
image: kiamol/ch07-timecheck
|
||||
volumeMounts:
|
||||
- name: config-dir
|
||||
mountPath: /config
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config-map
|
||||
configMap:
|
||||
name: timecheck-config
|
||||
- name: config-dir
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,49 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: timecheck
|
||||
labels:
|
||||
kiamol: ch07
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: timecheck
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: timecheck
|
||||
version: v3
|
||||
spec:
|
||||
initContainers:
|
||||
- name: init-config
|
||||
image: kiamol/ch03-sleep
|
||||
command: ['sh', '-c', 'cp /config-in/appsettings.json /config-out/appsettings.json']
|
||||
volumeMounts:
|
||||
- name: config-map
|
||||
mountPath: /config-in
|
||||
- name: config-dir
|
||||
mountPath: /config-out
|
||||
containers:
|
||||
- name: timecheck
|
||||
image: kiamol/ch07-timecheck
|
||||
volumeMounts:
|
||||
- name: config-dir
|
||||
mountPath: /config
|
||||
readOnly: true
|
||||
- name: logs-dir
|
||||
mountPath: /logs
|
||||
- name: logger
|
||||
image: kiamol/ch03-sleep
|
||||
command: ['sh', '-c', 'tail -f /logs-ro/timecheck.log']
|
||||
volumeMounts:
|
||||
- name: logs-dir
|
||||
mountPath: /logs-ro
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config-map
|
||||
configMap:
|
||||
name: timecheck-config
|
||||
- name: config-dir
|
||||
emptyDir: {}
|
||||
- name: logs-dir
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,18 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: timecheck
|
||||
labels:
|
||||
kiamol: ch07
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: timecheck
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: timecheck
|
||||
spec:
|
||||
containers:
|
||||
- name: timecheck
|
||||
image: kiamol/ch07-timecheck
|
||||
Reference in New Issue
Block a user