写点什么

2022-12-25:etcd 可以完全替代 zookeeper,原因是 k8s 用的 etcd,不用担心不成熟。请问 etcd 部署在 k3s 中,yaml 如何写?

  • 2022-12-25
    北京
  • 本文字数:871 字

    阅读完需:约 3 分钟

2022-12-25:etcd可以完全替代zookeeper,原因是k8s用的etcd,不用担心不成熟。请问etcd部署在k3s中,yaml如何写?

2022-12-25:etcd 可以完全替代 zookeeper,原因是 k8s 用的 etcd,不用担心不成熟。请问 etcd 部署在 k3s 中,yaml 如何写?


答案 2022-12-25:


用户名:root 密码:moonfdd


yaml 如下:


apiVersion: apps/v1kind: Deploymentmetadata:  labels:    app: etcd  name: etcd  namespace: moonfddspec:  replicas: 1  selector:    matchLabels:      app: etcd  template:    metadata:      labels:        app: etcd    spec:      containers:        - env:            - name: "ETCD_ROOT_PASSWORD"              value: "moonfdd"            - name: "ETCD_ADVERTISE_CLIENT_URLS"              value: "http://0.0.0.0:2379"            - name: "ETCD_LISTEN_PEER_URLS"              value: "http://0.0.0.0:2380"            - name: "ETCD_INITIAL_ADVERTISE_PEER_URLS"              value: "http://0.0.0.0:2380"            - name: "ETCD_INITIAL_CLUSTER"              value: "moonfdd=http://0.0.0.0:2380"            - name: "ETCD_NAME"              value: "moonfdd"            - name: "ETCD_DATA_DIR"              value: "/opt/bitnami/etcd/data"          image: bitnami/etcd          securityContext:            privileged: true          imagePullPolicy: IfNotPresent          name: etcd          volumeMounts:            - mountPath: /opt/bitnami/etcd/data              name: volv2      volumes:        - hostPath:            path: /root/k8s/moonfdd/etcd/opt/bitnami/etcd/data            type: DirectoryOrCreate          name: volv2---apiVersion: v1kind: Servicemetadata:  labels:    app: etcd  name: etcd  namespace: moonfddspec:  ports:    - port: 2379      protocol: TCP      targetPort: 2379      name: 2379-2379    - port: 2380      protocol: TCP      targetPort: 2380      name: 2380-2380  selector:    app: etcd  type: NodePort
复制代码





发布于: 刚刚阅读数: 7
用户头像

还未添加个人签名 2021-02-15 加入

还未添加个人简介

评论

发布
暂无评论
2022-12-25:etcd可以完全替代zookeeper,原因是k8s用的etcd,不用担心不成熟。请问etcd部署在k3s中,yaml如何写?_云原生_福大大架构师每日一题_InfoQ写作社区