集成完成

This commit is contained in:
feilong.teng@rheinchina.com
2021-12-12 19:49:39 +08:00
commit cd824b7f0c
462 changed files with 33688 additions and 0 deletions

13
deploy/Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM alpine:latest
LABEL MAINTAINER="PandaX"
WORKDIR /go/src/panda
COPY ./dziot ./
COPY ./config.yaml ./
COPY ./kubeconfig ./
COPY ./web ./web
COPY ./resource ./resource
EXPOSE 8080
ENTRYPOINT ./dziot -c ./config.yaml -kc ./kubeconfig

17
deploy/README.md Normal file
View File

@@ -0,0 +1,17 @@
## k8s部署流程
1. 设置打包环境
set GOOS=linux
set GOARCH=amd64
2. 构建Linux执行命令
go build -o pandax .
4. 构建docker镜像 (修改版本号 例如pandax/pandax:v1.0)
docker build -t pandax/pandax:v1.0
5. 上传daocker镜像
docker push pandax/pandax:v1.0
6. 生成 deploy.yaml
kubectl kustomize deploy/manifest -o deploy/deploy.yaml
7. k8s安装yaml
kubectl apply -f deploy/deploy.yaml
8. 查看 yaml 的安装状态
kubectl get pods -n pandax
kubectl get services -n pandax

View File

@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: pandax
labels:
app.kubernetes.io/name: pandax
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: pandax
template:
metadata:
labels:
app.kubernetes.io/name: pandax
spec:
serviceAccountName: pandax
containers:
- name: pandax
image: pandax/pandax:v1.0
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 7788
protocol: TCP

View File

@@ -0,0 +1,8 @@
resources:
- namespace.yaml
- deployment.yaml
- rbac.yaml
- service.yaml
commonLabels:
app.kubernetes.io/version: 1.0.0
namespace: pandax

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/name: pandax
app.kubernetes.io/version: master
name: pandax

20
deploy/manifest/rbac.yaml Normal file
View File

@@ -0,0 +1,20 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: pandax
labels:
app.kubernetes.io/name: pandax
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: pandax-rolebinding
labels:
app.kubernetes.io/name: pandax
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: pandax

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: pandax
labels:
app.kubernetes.io/name: pandax
spec:
type: LoadBalancer
ports:
- port: 7788
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: pandax