k8s安装powerjob
k8s安装powerjob
1、mysql
- mkdir -p ~/powerjob-yml
- kubectl create ns powerjob
复制代码- kubectl apply -f ~/powerjob-yml/powerjob-mysql.yml
复制代码- kubectl exec -it powerjob-mysql-0 -n powerjob -- mysql -pPowerjob@2024 -e "show databases;"
- kubectl exec -it powerjob-mysql-0 -n powerjob -- mysql -pPowerjob@2024 -e "select host,user from mysql.user;"
- kubectl exec -it powerjob-mysql-0 -n powerjob -- mysql -pPowerjob@2024 -e "alter user 'root'@'%' identified with mysql_native_password by 'Powerjob@2024';"
- kubectl exec -it powerjob-mysql-0 -n powerjob -- mysql -pPowerjob@2024 -e "flush privileges;"
- CREATE DATABASE IF NOT EXISTS `powerjob-product` DEFAULT CHARSET utf8mb4;
复制代码 2、mongodb
- cat > ~/powerjob-yml/powerjob-mongodb.yml << 'EOF'
- apiVersion: apps/v1
- kind: StatefulSet
- metadata:
- name: powerjob-mongodb
- namespace: powerjob
- spec:
- serviceName: "powerjob-mongodb-headless"
- replicas: 1
- selector:
- matchLabels:
- app: powerjob-mongodb
- template:
- metadata:
- labels:
- app: powerjob-mongodb
- spec:
- containers:
- - name: powerjob-mongodb
- image: ccr.ccs.tencentyun.com/huanghuanhui/mongo:7.0.8
- ports:
- - containerPort: 27017
- name: mongodb
- volumeMounts:
- - name: powerjob-mongodb-data-pvc
- mountPath: /data/db
- - name: localtime
- mountPath: /etc/localtime
- volumes:
- - name: localtime
- hostPath:
- path: /etc/localtime
- volumeClaimTemplates:
- - metadata:
- name: powerjob-mongodb-data-pvc
- spec:
- accessModes: ["ReadWriteOnce"]
- storageClassName: cfs
- resources:
- requests:
- storage: 100Gi
- ---
- apiVersion: v1
- kind: Service
- metadata:
- name: powerjob-mongodb-headless
- namespace: powerjob
- labels:
- app: powerjob-mongodb
- spec:
- clusterIP: None
- ports:
- - port: 27017
- name: powerjob-mongodb
- targetPort: 27017
- selector:
- app: powerjob-mongodb
- ---
- apiVersion: v1
- kind: Service
- metadata:
- name: powerjob-mongodb
- namespace: powerjob
- labels:
- app: powerjob-mongodb
- spec:
- type: NodePort
- ports:
- - port: 27017
- targetPort: 27017
- nodePort: 30277
- selector:
- app: powerjob-mongodb
- EOF
复制代码- kubectl apply -f ~/powerjob-yml/powerjob-mongodb.yml
复制代码 3、powerjob
- cat > ~/powerjob-yml/powerjob.yml << 'EOF'
- apiVersion: apps/v1
- kind: StatefulSet
- metadata:
- name: powerjob-server
- namespace: powerjob
- spec:
- serviceName: "powerjob-server-headless"
- replicas: 1
- selector:
- matchLabels:
- app: powerjob-server
- template:
- metadata:
- labels:
- app: powerjob-server
- spec:
- containers:
- - name: powerjob-server
- image: ccr.ccs.tencentyun.com/huanghuanhui/powerjob-server:4.3.9
- ports:
- - containerPort: 7700
- name: http
- - containerPort: 10086
- name: agent
- - containerPort: 10010
- name: admin
- env:
- - name: TZ
- value: "Asia/Shanghai"
- - name: JVMOPTIONS
- value: ""
- - name: PARAMS
- value: "--spring.profiles.active=product --spring.datasource.core.jdbc-url=jdbc:mysql://powerjob-mysql-headless:3306/powerjob-product?useUnicode=true&characterEncoding=UTF-8 --spring.datasource.core.username=root --spring.datasource.core.password=Powerjob@2024 --spring.data.mongodb.uri=mongodb://powerjob-mongodb-headless:27017/powerjob-product"
- volumeMounts:
- - name: powerjob-data-pvc
- mountPath: /root/powerjob/server
- - name: m2-repo
- mountPath: /root/.m2
- volumes:
- - name: m2-repo
- emptyDir: {}
- volumeClaimTemplates:
- - metadata:
- name: powerjob-data-pvc
- spec:
- accessModes: ["ReadWriteOnce"]
- storageClassName: cfs
- resources:
- requests:
- storage: 100Gi
- ---
- apiVersion: v1
- kind: Service
- metadata:
- name: powerjob-server
- namespace: powerjob
- labels:
- app: powerjob-server
- spec:
- type: NodePort
- ports:
- - name: http
- port: 7700
- targetPort: http
- nodePort: 30077
- - name: agent
- port: 10086
- targetPort: agent
- nodePort: 30086
- - name: admin
- port: 10010
- targetPort: admin
- nodePort: 30110
- selector:
- app: powerjob-server
- EOF
复制代码- kubectl apply -f ~/powerjob-yml/powerjob.yml
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |