2022-02-25:k8s安装zookeeper,yaml如何写?找份北京的golang后端工作,35岁,有人收我吗?

答案2022-02-25:

yaml如下:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: zookeeper
  name: zookeeper
  namespace: moonfdd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: zookeeper
  template:
    metadata:
      labels:
        app: zookeeper
    spec:
      containers:
        - image: zookeeper
          imagePullPolicy: IfNotPresent
          name: zookeeper
#          volumeMounts:
#            - mountPath: /opt/zookeeper/data
#              name: data
#      volumes:
#        - name: data
#          hostPath:
#            path: /root/k8s/moonfdd/zookeeper/opt/zookeeper/data
#            type: DirectoryOrCreate
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: zookeeper
  name: zookeeper
  namespace: moonfdd
spec:
  ports:
    - port: 2181
      protocol: TCP
      targetPort: 2181
  selector:
    app: zookeeper
  type: NodePort

结果如下:

在这里插入图片描述

zookeeper的yaml