77
k8s/README.md
Normal file
77
k8s/README.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# Deploy services on Kubernetes
|
||||||
|
|
||||||
|
In Kubernetes, the service consists of two components,
|
||||||
|
|
||||||
|
1. Environments
|
||||||
|
2. Applications
|
||||||
|
|
||||||
|
And you can choose the storage in the application either NFS or Cinder provided by Openstack(used by [Pasta](http://paas-ta.kr))
|
||||||
|
|
||||||
|
# Prerequisites
|
||||||
|
|
||||||
|
## Install kustomize
|
||||||
|
|
||||||
|
If you are using kubectl 1.14 or later, it embeded kustomize. So please ignore this section.
|
||||||
|
I recommend that you install the latest version of [kubectl](https://kubectl.docs.kubernetes.io/installation/kubectl/) for your cluster instead of installing kustomize.
|
||||||
|
Even so, if you want to use kustomize, refer to [official kustomize doc](https://kustomize.io/).
|
||||||
|
|
||||||
|
# Deploy service
|
||||||
|
|
||||||
|
You must follow deployment order.
|
||||||
|
|
||||||
|
## Deployenvironments
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kustomize build k8s/environments | kubectl apply -f -
|
||||||
|
```
|
||||||
|
or if you are using the kubectl only,
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kubectl apply -k k8s/environments
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deploy applications
|
||||||
|
|
||||||
|
If you want to use NFS as a main storage,
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kustomize build k8s/stoage/nfs | kubectl apply -f -
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kubectl apply -k k8s/stoage/nfs
|
||||||
|
```
|
||||||
|
|
||||||
|
In case of using Openstack storage(CINDER) as a main storage,
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kustomize build k8s/stoage/openstack | kubectl apply -f -
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kubectl apply -k k8s/stoage/openstack
|
||||||
|
```
|
||||||
|
|
||||||
|
# Shutdown service
|
||||||
|
|
||||||
|
Simply apply deployment in reverse order.
|
||||||
|
|
||||||
|
If you are using nfs,
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kustomize build k8s/environments | kubectl delete -f -
|
||||||
|
$ kustomize build k8s/stoage/nfs | kubectl delete -f - --wait
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kubectl delete -k k8s/environments
|
||||||
|
$ kubectl delete -k k8s/stoage/nfs --wait
|
||||||
|
```
|
||||||
|
|
||||||
|
The case of openstack is similar, so it is omitted.
|
||||||
75
k8s/applications/backend/kustomization.yaml
Normal file
75
k8s/applications/backend/kustomization.yaml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- config/service.yaml
|
||||||
|
- discovery/service.yaml
|
||||||
|
- portal-service/service.yaml
|
||||||
|
- reserve-item-service/service.yaml
|
||||||
|
- user-service/service.yaml
|
||||||
|
- board-service/service.yaml
|
||||||
|
- reserve-request-service/service.yaml
|
||||||
|
- reserve-check-service/service.yaml
|
||||||
|
- discovery/ingress/ingress.yaml
|
||||||
|
- apigateway/ingress/ingress.yaml
|
||||||
|
- config/deployment.yaml
|
||||||
|
- discovery/deployment.yaml
|
||||||
|
- portal-service/deployment.yaml
|
||||||
|
- reserve-item-service/deployment.yaml
|
||||||
|
- user-service/deployment.yaml
|
||||||
|
- board-service/deployment.yaml
|
||||||
|
- apigateway/deployment.yaml
|
||||||
|
- apigateway/service.yaml
|
||||||
|
- reserve-request-service/deployment.yaml
|
||||||
|
- reserve-check-service/deployment.yaml
|
||||||
|
- portal-service/autoscaler.yaml
|
||||||
|
- reserve-item-service/autoscaler.yaml
|
||||||
|
- user-service/autoscaler.yaml
|
||||||
|
- board-service/autoscaler.yaml
|
||||||
|
- apigateway/autoscaler.yaml
|
||||||
|
- reserve-request-service/autoscaler.yaml
|
||||||
|
- reserve-check-service/autoscaler.yaml
|
||||||
|
|
||||||
|
|
||||||
|
images:
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-apigateway:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-apigateway
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-board-service:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-board-service
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-config:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-config
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-discovery:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-discovery
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-portal-service:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-portal-service
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-reserve-check-service:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-reserve-check-service
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-reserve-item-service:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-reserve-item-service
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-reserve-request-service:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-reserve-request-service
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-backend-user-service:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-backend-user-service
|
||||||
|
newTag: latest
|
||||||
|
|
||||||
|
|
||||||
|
patches:
|
||||||
|
- target:
|
||||||
|
name: apigateway-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: 백엔드 API 게이트웨이 도메인>"
|
||||||
|
- target:
|
||||||
|
name: discovery-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: 백엔드 유레카 서버 도메인>"
|
||||||
35
k8s/applications/frontend/kustomization.yaml
Normal file
35
k8s/applications/frontend/kustomization.yaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- portal/service.yaml
|
||||||
|
- admin/service.yaml
|
||||||
|
- portal/ingress/ingress.yaml
|
||||||
|
- admin/ingress/ingress.yaml
|
||||||
|
- portal/deployment.yaml
|
||||||
|
- admin/deployment.yaml
|
||||||
|
- portal/autoscaler.yaml
|
||||||
|
- admin/autoscaler.yaml
|
||||||
|
|
||||||
|
|
||||||
|
images:
|
||||||
|
- name: egovframe/egovframe-msa-edu-frontend-admin:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-frontend-admin
|
||||||
|
newTag: latest
|
||||||
|
- name: egovframe/egovframe-msa-edu-frontend-portal:latest
|
||||||
|
# newName: foobar/egovframe-msa-edu-frontend-portal
|
||||||
|
newTag: latest
|
||||||
|
|
||||||
|
|
||||||
|
patches:
|
||||||
|
- target:
|
||||||
|
name: frontend-portal-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: 프론트엔드 포털 도메인>"
|
||||||
|
- target:
|
||||||
|
name: frontend-admin-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: 프론트엔드 관리자 도메인>"
|
||||||
5
k8s/applications/kustomization.yaml
Normal file
5
k8s/applications/kustomization.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- frontend/
|
||||||
|
- backend/
|
||||||
60
k8s/environments/kustomization.yaml
Normal file
60
k8s/environments/kustomization.yaml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- configmaps/backend-configmap.yaml
|
||||||
|
- configmaps/common-configmap.yaml
|
||||||
|
- nfs/sa.yaml
|
||||||
|
- nfs/sc.yaml
|
||||||
|
- nfs/deployment.yaml
|
||||||
|
- databases/mysql/secret.yaml
|
||||||
|
- databases/mysql/configmap.yaml
|
||||||
|
- databases/mysql/service.yaml
|
||||||
|
- databases/mysql/pvc.yaml
|
||||||
|
- databases/mysql/statefulset.yaml
|
||||||
|
- rabbitmq/service.yaml
|
||||||
|
- rabbitmq/ingress/ingress.yaml
|
||||||
|
- rabbitmq/deployment.yaml
|
||||||
|
- zipkin/service.yaml
|
||||||
|
- zipkin/ingress/ingress.yaml
|
||||||
|
- zipkin/deployment.yaml
|
||||||
|
- jenkins/sa.yaml
|
||||||
|
- jenkins/service.yaml
|
||||||
|
- jenkins/ingress.yaml
|
||||||
|
- jenkins/pvc.yaml
|
||||||
|
- jenkins/statefulset.yaml
|
||||||
|
- logging/elk/kibana/configmap.yaml
|
||||||
|
- logging/elk/kibana/service.yaml
|
||||||
|
- logging/elk/kibana/ingress/ingress.yaml
|
||||||
|
- logging/elk/kibana/deployment.yaml
|
||||||
|
- logging/elk/logstash/service.yaml
|
||||||
|
- logging/elk/logstash/configmap.yaml
|
||||||
|
- logging/elk/logstash/deplyment.yaml
|
||||||
|
- logging/elk/elasticsearch/service.yaml
|
||||||
|
- logging/elk/elasticsearch/deployment.yaml
|
||||||
|
|
||||||
|
|
||||||
|
patches:
|
||||||
|
- target:
|
||||||
|
name: rabbitmq-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: RabbitMQ 도메인>"
|
||||||
|
- target:
|
||||||
|
name: zipkin-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: Zipkin 도메인>"
|
||||||
|
- target:
|
||||||
|
name: jenkins-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: 젠킨스 도메인>"
|
||||||
|
- target:
|
||||||
|
name: kibana-ingress
|
||||||
|
patch: |-
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: "<TODO: ELK Kibana 도메인>"
|
||||||
6
k8s/storage/nfs/kustomization.yaml
Normal file
6
k8s/storage/nfs/kustomization.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
bases:
|
||||||
|
- ../../environments
|
||||||
|
resources:
|
||||||
|
- pvc-nfs.yaml
|
||||||
6
k8s/storage/openstack/kustomization.yaml
Normal file
6
k8s/storage/openstack/kustomization.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
bases:
|
||||||
|
- ../../environments
|
||||||
|
resources:
|
||||||
|
- pvc-egovcp.yaml
|
||||||
Reference in New Issue
Block a user