Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
joohanhong
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JooHan Hong
joohanhong
Commits
76f2c7a6
Commit
76f2c7a6
authored
Aug 08, 2022
by
JooHan Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
k8s, oper update2
parent
ae49c543
Pipeline
#6064
passed with stages
in 1 minute and 14 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
577 additions
and
2 deletions
+577
-2
README.md
MON/FRONTEND/K8S_OPER/DBAPI/README.md
+191
-0
README.md
MON/FRONTEND/K8S_OPER/NGINX/README.md
+191
-0
README.md
MON/FRONTEND/K8S_OPER/NODEJS/README.md
+191
-0
README.md
MON/FRONTEND/README.md
+4
-2
No files found.
MON/FRONTEND/K8S_OPER/README.md
→
MON/FRONTEND/K8S_OPER/
DBAPI/
README.md
View file @
76f2c7a6
...
...
@@ -2,8 +2,7 @@
# MON Operation Overview
> K8s 기반의 Front-End System Overview
> K8s 설치 과정은 생략한다.
> K8s 기반의 **Nginx** Front-End System Overview
# K8s Deployment Current Status
...
...
@@ -31,7 +30,7 @@ monitor-nodejs-f68967947-vrchl 1/1 Running 0 5d23h 10
## Nginx Deployment yaml
> 역할 : Nginx POD를
생성
하는 Deployment를 작성한다.
> 역할 : Nginx POD를
배포
하는 Deployment를 작성한다.
```
...
...
@@ -96,138 +95,97 @@ spec:
- name: harbor-login
```
## N
ode.js API Deployment
yaml
## N
ginx HPA Scale
yaml
> 역할 :
> 역할 :
AutoScaling 정책을 작성한다.
```
# cat mon_
nodejs
.yaml
apiVersion: a
pps
/v1
kind:
Deployment
# cat mon_
scale_nginx
.yaml
apiVersion: a
utoscaling
/v1
kind:
HorizontalPodAutoscaler
metadata:
labels:
app: nodejs
name: monitor-nodejs
name: nginx-hpa
namespace: default
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
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: monitor-nginx
minReplicas: 2
maxReplicas: 3
targetCPUUtilizationPercentage: 80
```
## N
ode.js DB API Deployment
yaml
## N
ginx Service
yaml
> 역할 :
> 역할 :
Nginx Service를 작성한다. 여기서는 NodePort 방식을 통해 배포한다.
```
# cat mon_
dbapi
.yaml
apiVersion:
apps/
v1
kind:
Deployment
# cat mon_
service_nginx
.yaml
apiVersion: v1
kind:
Service
metadata:
labels:
app: dbapi
name: monitor-dbapi
name: monitor-nginx
spec:
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
externalTrafficPolicy: Local
type: NodePort
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
app: nginx
ports:
- name: nginx
port: 80
protocol: TCP
targetPort: 80
nodePort: 32000
```
## 실행
> 배포 및 관리는 여러 가지 방법이 있지만, 여기서는 **kubectl** 을 사용하여 실행한다.
-
**시작**
```
# cat start-mon_nginx.sh
#!/bin/bash
kubectl create -f mon_nginx.yaml
kubectl create -f mon_scale_nginx.yaml
kubectl create -f mon_service_nginx.yaml
```
실행결과는 다음과 같다.
```
# ./start-mon_nginx.sh
deployment.apps/monitor-nginx created
horizontalpodautoscaler.autoscaling/nginx-hpa created
service/monitor-nginx created
```
-
**중지**
```
# cat stop-mon_nginx.sh
#!/bin/bash
kubectl delete -f mon_service_nginx.yaml
kubectl delete -f mon_scale_nginx.yaml
kubectl delete -f mon_nginx.yaml
#kubectl delete hpa monitor-nginx
```
실행결과는 다음과 같다.
```
# ./stop-mon_nginx.sh
service "monitor-nginx" deleted
horizontalpodautoscaler.autoscaling "nginx-hpa" deleted
deployment.apps "monitor-nginx" deleted
```
MON/FRONTEND/K8S_OPER/NGINX/README.md
0 → 100644
View file @
76f2c7a6
[
![logo
](
https://www.hongsnet.net/images/logo.gif
)
](https://www.hongsnet.net)
# MON Operation Overview
> K8s 기반의 **Nginx** Front-End System Overview
# K8s Deployment Current Status
```
# kubectl get pods -o wide |grep mon
monitor-dbapi-74cb655d-8lxzb 1/1 Running 0 5d23h 10.244.4.7 tb3-docker <none> <none>
monitor-dbapi-74cb655d-grngk 1/1 Running 0 5d23h 10.244.3.253 tb3 <none> <none>
monitor-nginx-7cdb67c44f-c7x47 1/1 Running 0 5d23h 10.244.3.252 tb3 <none> <none>
monitor-nginx-7cdb67c44f-fb8tk 1/1 Running 0 5d23h 10.244.6.142 tb2 <none> <none>
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
```
## Nginx HPA Scale yaml
> 역할 : AutoScaling 정책을 작성한다.
```
# cat mon_scale_nginx.yaml
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: nginx-hpa
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: monitor-nginx
minReplicas: 2
maxReplicas: 3
targetCPUUtilizationPercentage: 80
```
## Nginx Service yaml
> 역할 : Nginx Service를 작성한다. 여기서는 NodePort 방식을 통해 배포한다.
```
# cat mon_service_nginx.yaml
apiVersion: v1
kind: Service
metadata:
name: monitor-nginx
spec:
externalTrafficPolicy: Local
type: NodePort
selector:
app: nginx
ports:
- name: nginx
port: 80
protocol: TCP
targetPort: 80
nodePort: 32000
```
## 실행
> 배포 및 관리는 여러 가지 방법이 있지만, 여기서는 **kubectl** 을 사용하여 실행한다.
-
**시작**
```
# cat start-mon_nginx.sh
#!/bin/bash
kubectl create -f mon_nginx.yaml
kubectl create -f mon_scale_nginx.yaml
kubectl create -f mon_service_nginx.yaml
```
실행결과는 다음과 같다.
```
# ./start-mon_nginx.sh
deployment.apps/monitor-nginx created
horizontalpodautoscaler.autoscaling/nginx-hpa created
service/monitor-nginx created
```
-
**중지**
```
# cat stop-mon_nginx.sh
#!/bin/bash
kubectl delete -f mon_service_nginx.yaml
kubectl delete -f mon_scale_nginx.yaml
kubectl delete -f mon_nginx.yaml
#kubectl delete hpa monitor-nginx
```
실행결과는 다음과 같다.
```
# ./stop-mon_nginx.sh
service "monitor-nginx" deleted
horizontalpodautoscaler.autoscaling "nginx-hpa" deleted
deployment.apps "monitor-nginx" deleted
```
MON/FRONTEND/K8S_OPER/NODEJS/README.md
0 → 100644
View file @
76f2c7a6
[
![logo
](
https://www.hongsnet.net/images/logo.gif
)
](https://www.hongsnet.net)
# MON Operation Overview
> K8s 기반의 **Nginx** Front-End System Overview
# K8s Deployment Current Status
```
# kubectl get pods -o wide |grep mon
monitor-dbapi-74cb655d-8lxzb 1/1 Running 0 5d23h 10.244.4.7 tb3-docker <none> <none>
monitor-dbapi-74cb655d-grngk 1/1 Running 0 5d23h 10.244.3.253 tb3 <none> <none>
monitor-nginx-7cdb67c44f-c7x47 1/1 Running 0 5d23h 10.244.3.252 tb3 <none> <none>
monitor-nginx-7cdb67c44f-fb8tk 1/1 Running 0 5d23h 10.244.6.142 tb2 <none> <none>
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
```
## Nginx HPA Scale yaml
> 역할 : AutoScaling 정책을 작성한다.
```
# cat mon_scale_nginx.yaml
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: nginx-hpa
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: monitor-nginx
minReplicas: 2
maxReplicas: 3
targetCPUUtilizationPercentage: 80
```
## Nginx Service yaml
> 역할 : Nginx Service를 작성한다. 여기서는 NodePort 방식을 통해 배포한다.
```
# cat mon_service_nginx.yaml
apiVersion: v1
kind: Service
metadata:
name: monitor-nginx
spec:
externalTrafficPolicy: Local
type: NodePort
selector:
app: nginx
ports:
- name: nginx
port: 80
protocol: TCP
targetPort: 80
nodePort: 32000
```
## 실행
> 배포 및 관리는 여러 가지 방법이 있지만, 여기서는 **kubectl** 을 사용하여 실행한다.
-
**시작**
```
# cat start-mon_nginx.sh
#!/bin/bash
kubectl create -f mon_nginx.yaml
kubectl create -f mon_scale_nginx.yaml
kubectl create -f mon_service_nginx.yaml
```
실행결과는 다음과 같다.
```
# ./start-mon_nginx.sh
deployment.apps/monitor-nginx created
horizontalpodautoscaler.autoscaling/nginx-hpa created
service/monitor-nginx created
```
-
**중지**
```
# cat stop-mon_nginx.sh
#!/bin/bash
kubectl delete -f mon_service_nginx.yaml
kubectl delete -f mon_scale_nginx.yaml
kubectl delete -f mon_nginx.yaml
#kubectl delete hpa monitor-nginx
```
실행결과는 다음과 같다.
```
# ./stop-mon_nginx.sh
service "monitor-nginx" deleted
horizontalpodautoscaler.autoscaling "nginx-hpa" deleted
deployment.apps "monitor-nginx" deleted
```
MON/FRONTEND/README.md
View file @
76f2c7a6
...
...
@@ -11,5 +11,7 @@
| ------ | ------ | ------ | ------ |
| 1 | HA-Proxy 설치 및 구성 |
[
GO
](
../../INFRA/HA-PROXY/
)
| |
| 2 | K8s 구성 내역 |
[
GO
](
./K8S/
)
| |
| 3 | K8s 운용 내역|
[
GO
](
./K8S_OPER/
)
| |
| 4 | CI/CD 배포 구성|
[
GO
](
./MON_CICD/
)
| |
| 3 | Nginx Front-End 구성|
[
GO
](
./K8S_OPER/NGINX/
)
| |
| 4 | API(Node.js) Front-End 구성|
[
GO
](
./K8S_OPER/NODEJS/
)
| |
| 5 | DB API(Node.js) Front-End 구성|
[
GO
](
./K8S_OPER/DBAPI/
)
| |
| 6 | CI/CD 배포 구성|
[
GO
](
./MON_CICD/
)
| |
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment