(2)TiDB单机-k8s配置

deployment:

apiVersion: apps/v1
kind: Deployment  # 类型是部署
metadata:
  name: tidb-steven01  # 对象的名字
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: tidb-steven01 #用来绑定label是“tidb-steven01”的Pod
  strategy:
    type: Recreate #部署策略:停止旧版本部署新版本
  template:   # 开始定义Pod
    metadata:
      labels:
        app: tidb-steven01  #Pod的Label,用来标识Pod
    spec:
      nodeName: node2
      containers: # 开始定义Pod里面的容器
        - image: pingcap/tidb
          name: tidb-container
          imagePullPolicy: IfNotPresent  #默认值,本地有则使用本地镜像,不拉取
          ports:
            - containerPort: 4000 #
              name: tidb-port1
            - containerPort: 10080 #
              name: tidb-port2
          volumeMounts:
            - mountPath: /tmp/tidb
              name: datadir
      volumes:
        - name: datadir
          hostPath:
            path: /root/tidb/data

service:

apiVersion: v1
kind: Service
metadata:
  name: tidb-svc
  labels:
    name: tidb-svc
spec:
  type: NodePort
  ports:
    - port: 4000
      targetPort: 4000
      nodePort: 30040
  selector:
    app: tidb-steven01

 

你可能感兴趣的:(#,TiDB)