2022-02-25:k8s安装zookeeper,yaml如何写?

2022-03-04 15:22:15 浏览数 (1)

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

答案2022-02-25:

yaml如下:

代码语言:javascript复制
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](https://gitee.com/moonfdd/k8syaml/blob/master/moonfdd/zookeeper.yaml)

0 人点赞