mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
集成完成
This commit is contained in:
13
deploy/Dockerfile
Normal file
13
deploy/Dockerfile
Normal 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
17
deploy/README.md
Normal 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
|
||||
25
deploy/manifest/deployment.yaml
Normal file
25
deploy/manifest/deployment.yaml
Normal 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
|
||||
8
deploy/manifest/kustomization.yaml
Normal file
8
deploy/manifest/kustomization.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- deployment.yaml
|
||||
- rbac.yaml
|
||||
- service.yaml
|
||||
commonLabels:
|
||||
app.kubernetes.io/version: 1.0.0
|
||||
namespace: pandax
|
||||
7
deploy/manifest/namespace.yaml
Normal file
7
deploy/manifest/namespace.yaml
Normal 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
20
deploy/manifest/rbac.yaml
Normal 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
|
||||
15
deploy/manifest/service.yaml
Normal file
15
deploy/manifest/service.yaml
Normal 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
|
||||
Reference in New Issue
Block a user