k8s安装zookeeper

apiVersion: apps/v1
kind: Deployment
metadata:
  name: zookeeper
  namespace: liyuan
  labels:
    app: zk
spec:
  selector:
    matchLabels:
      app: zk
  template:
    metadata:
      labels:
        app: zk
    spec:
      nodeName: liyuan-node2
      containers:
      - name: zk
        image: zookeeper
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 2181
          name: zk
        resources:
          requests:
            cpu: "0.1"
            memory: "500Mi"
          limits:
            cpu: "0.1"
            memory: "500Mi"

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: zk
  name: zk-svc
  namespace: liyuan
spec:
  ports:
  - port: 2181
    nodePort: 30002
    targetPort: 2181
  selector:
    app: zk
  type: NodePort
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐