k8s 部署xxljob

具体为什么部署xxljob可以进行参考:https://gitee.com/xuxueli0323/xxl-job?_from=gitee_search

搭建现有的k8s环境,我这边已经搭建完成了:可以参考:

https://blog.csdn.net/weixin_44932410/article/details/119566383

这边直接单集群启动的,方便演示
在这里插入图片描述

准备2,搭建mysql数据库导入xxljob数据:

https://gitee.com/xuxueli0323/xxl-job?_from=gitee_search
其中数据库的路径修改成自己即可,执行完整之后会自动创建一个库

k8s 部署xxljob_第1张图片

开始进行部署xxljob

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: xxl-job-admin
  name: xxl-job-admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: xxl-job-admin
  strategy: {}
  template:
    metadata:
      labels:
        app: xxl-job-admin
    spec:
      containers:
      - image: xuxueli/xxl-job-admin:2.3.1
        name: xxl-job-admin
        ports:
        - containerPort: 8080
        env:
        - name: PARAMS
          value: "--spring.datasource.url=jdbc:mysql://localhost:3306/xxl_job?Unicode=true&characterEncoding=UTF-8&useSSL=false --spring.datasource.username=root --spring.datasource.password=123456"
---
apiVersion: v1
kind: Service
metadata:
  name: xxl-job-admin
  labels:
    app: xxl-job-admin
spec:
  ports:
  - port: 8080
    protocol: TCP
    name: http
  selector:
    app: xxl-job-admin

你可能感兴趣的:(笔记,k8s,linux,kubernetes,java,容器)