K8S YAML 部署XXLJOB 集群

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: xxl-job-admin
  name: xxl-job-admin
  namespace: ccetest  #根据情况修改namespace
spec:
  replicas: 3         #根据情况修改副本数
  selector:
    matchLabels:
      app: xxl-job-admin
  strategy: {}
  template:
    metadata:
      labels:
        app: xxl-job-admin
    spec:
      imagePullSecrets:
      - name: default-secret    #镜像拉取秘钥
      containers:
      - image: xuxueli/xxl-job-admin:2.3.1 #根据情况修改镜像名称
        imagePullPolicy: Always
        name: xxl-job-admin
        ports:
        - containerPort: 8080
        env:
        - name: PARAMS
          value: "--spring.datasource.url=jdbc:mysql://MYSQL/DB?Unicode=true&characterEncoding=UTF-8&useSSL=false --spring.datasource.username=DB_USERNAME--spring.datasource.password=DB_PWD"
---
apiVersion: v1
kind: Service
metadata:
  name: xxl-job-admin
  namespace: ccetest  #根据情况修改namespace
  labels:
    app: xxl-job-admin
spec:
  ports:
  - port: 8080
    targetPort: 8080
    protocol: TCP
    name: http
    nodePort: 30081
  type: NodePort
  selector:
    app: xxl-job-admin

你可能感兴趣的:(DFSK,kubernetes,云原生,容器)