• K8S跑单点zk


    1.编写yaml

    apiVersion: v1
    kind: Service
    metadata:
      name: zk-hs
      namespace: uat
      labels:
        app: zk
    spec:
      ports:
      - port: 2888
        name: server
      - port: 3888
        name: leader-election
      clusterIP: None
      selector:
        app: zk
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: zk-cs
      namespace: uat
      labels:
        app: zk
    spec:
      ports:
      - port: 2181
        name: client
      selector:
        app: zk
    ---
    apiVersion: policy/v1beta1
    kind: PodDisruptionBudget
    metadata:
      name: zk-pdb
      namespace: uat
    spec:
      selector:
        matchLabels:
          app: zk
      maxUnavailable: 1
    ---
    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: zk
      namespace: uat
    spec:
      selector:
        matchLabels:
          app: zk
      serviceName: zk-hs
      replicas: 1 # 集群改成3
      updateStrategy:
        type: RollingUpdate
      podManagementPolicy: OrderedReady
      template:
        metadata:
          labels:
            app: zk
        spec:
          nodeSelector:
            env: uat
          containers:
          - name: kubernetes-zookeeper
            imagePullPolicy: IfNotPresent
            image: k8s.gcr.io/kubernetes-zookeeper:1.0-3.4.10
            resources:
              requests:
                memory: "1Gi"
                cpu: "0.5"
            ports:
            - containerPort: 2181
              name: client
            - containerPort: 2888
              name: server
            - containerPort: 3888
              name: leader-election
            command:
            - sh
            - -c
            - "start-zookeeper 
              --servers=1  # 如果是集群的话这边改成3
              --data_dir=/var/lib/zookeeper/data 
              --data_log_dir=/var/lib/zookeeper/data/log 
              --conf_dir=/opt/zookeeper/conf 
              --client_port=2181 
              --election_port=3888 
              --server_port=2888 
              --tick_time=2000 
              --init_limit=10 
              --sync_limit=5 
              --heap=512M 
              --max_client_cnxns=60 
              --snap_retain_count=3 
              --purge_interval=12 
              --max_session_timeout=40000 
              --min_session_timeout=4000 
              --log_level=INFO"
            readinessProbe:
              exec:
                command:
                - sh
                - -c
                - "zookeeper-ready 2181"
              initialDelaySeconds: 10
              timeoutSeconds: 5
            livenessProbe:
              exec:
                command:
                - sh
                - -c
                - "zookeeper-ready 2181"
              initialDelaySeconds: 10
              timeoutSeconds: 5
            volumeMounts:
              - name: datadir
                mountPath: /var/lib/zookeeper
          volumes:
          - name: datadir
            hostPath:
              path: /store/logs/uat/zk
              type: DirectoryOrCreate
    
  • 相关阅读:
    移动端开发 rem 案例
    html基值 仿淘宝
    使用FreeSWITCH做电话自动回访设置
    Nodejs 实现ESL内联FreeSWITCH设定说明
    ADC自动转接功能Lua实现
    sipML5聊天功能实现
    FreeSWITCH与PSTN对接
    FreeSWITCH Git版本管理
    FreeSWITCH Git版本管理
    SIP 认证
  • 原文地址:https://www.cnblogs.com/Applogize/p/15406655.html
Copyright © 2020-2023  润新知