Commit ae49c543 authored by JooHan Hong's avatar JooHan Hong

k8s, oper update1

parent 1b76aba6
Pipeline #6063 passed with stages
in 1 minute and 6 seconds
......@@ -6,7 +6,7 @@
> K8s 설치 과정은 생략한다.
# K8s POD Current Status
# K8s Deployment Current Status
```
# kubectl get pods -o wide |grep mon
......@@ -17,3 +17,217 @@ monitor-nginx-7cdb67c44f-fb8tk 1/1 Running 0 5d23h 10
monitor-nodejs-f68967947-qz7bm 1/1 Running 0 5d23h 10.244.4.6 tb3-docker <none> <none>
monitor-nodejs-f68967947-vrchl 1/1 Running 0 5d23h 10.244.4.5 tb3-docker <none> <none>
```
# Docker Private Registry(harbor.hongsnet.net) Secret
```
# kubectl create secret generic harbor-login --from-file=.dockerconfigjson=/root/.docker/config.json --type=kubernetes.io/dockerconfigjson
```
> Private Container Image에 대한 인증 Secret를 생성한다. 이는 다음의 Deployment에서 사용된다.
# monitor Deployment Status
## Nginx Deployment yaml
> 역할 : Nginx POD를 생성하는 Deployment를 작성한다.
```
# cat mon_nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: monitor-nginx
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: servertype
operator: NotIn
values:
- master
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- nginx
topologyKey: "kubernetes.io/hostname"
volumes:
- name: mon-home-volume
persistentVolumeClaim:
claimName: mon-home-volume-pvc
dnsPolicy: "None"
dnsConfig:
nameservers:
- 8.8.8.8
- 61.100.0.136
- 61.100.0.152
containers:
- image: harbor.hongsnet.net/monitor/monitoring-nginx:20220801_32
imagePullPolicy: IfNotPresent
name: monitor-nginx
volumeMounts:
- mountPath: /home
name: mon-home-volume
imagePullSecrets:
- name: harbor-login
```
## Node.js API Deployment yaml
> 역할 :
```
# cat mon_nodejs.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nodejs
name: monitor-nodejs
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: nodejs
template:
metadata:
labels:
app: nodejs
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: servertype
operator: NotIn
values:
- master
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- nodejs
topologyKey: "kubernetes.io/hostname"
volumes:
- name: mon-home-volume
persistentVolumeClaim:
claimName: mon-home-volume-pvc
dnsPolicy: "None"
dnsConfig:
nameservers:
- 8.8.8.8
- 61.100.0.136
- 61.100.0.152
containers:
- image: harbor.hongsnet.net/monitor/monitoring-nodejs:20220801_24
imagePullPolicy: IfNotPresent
name: monitor-nodejs
volumeMounts:
- mountPath: /home
name: mon-home-volume
imagePullSecrets:
- name: harbor-login
```
## Node.js DB API Deployment yaml
> 역할 :
```
# cat mon_dbapi.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: dbapi
name: monitor-dbapi
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: dbapi
template:
metadata:
labels:
app: dbapi
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: servertype
operator: NotIn
values:
- master
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- dbapi
topologyKey: "kubernetes.io/hostname"
volumes:
- name: mon-home-volume
persistentVolumeClaim:
claimName: mon-home-volume-pvc
dnsPolicy: "None"
dnsConfig:
nameservers:
- 8.8.8.8
- 61.100.0.136
- 61.100.0.152
containers:
- image: harbor.hongsnet.net/monitor/monitoring-nodejs-db:20220801_6
imagePullPolicy: IfNotPresent
name: monitor-dbapi
volumeMounts:
- mountPath: /home
name: mon-home-volume
imagePullSecrets:
- name: harbor-login
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment