• k8s 部署单节点rabbitmq


    k8s 部署单节点rabbitmq

    • 准备 nfs 存储
      10.65.0.111 为nfs server 
    
    • 创建 nfs 共享目录
    mkdir -p /export/nfs_share/volume-mytest/mq-prod 
    chmod 777 -R /export/nfs_share/volume-mytest/mq-prod
    
    • 准备pv、pvc
    cat > mq-prod-pvc-pv.yaml << EOF
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: mq-prod
      namespace: mytest
      labels:
        name: mq-prod
    spec:
      nfs:
        path: /export/nfs_share/volume-mytest/mq-prod
        server: 10.65.0.111
      accessModes: ["ReadWriteMany","ReadOnlyMany"]
      capacity:
        storage: 5Gi
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: mq-prod
      namespace: mytest
    spec:
      accessModes: ["ReadWriteMany"]
      resources:
        requests:
          storage: 5Gi
    EOF
    
    
    • 准备 deployment、svc 配置文件
    cat > mq-prod-deployment.yaml << EOF
    apiVersion: apps/v1beta1
    kind: Deployment
    metadata:
       namespace: mytest
       name: mq-prod
       labels:
         name: mq-prod
       annotations:
         blackbox_path: /
         blackbox_port: "80"
         blackbox_scheme: http
    spec:
      replicas: 1
      template:
        metadata:
         labels:
           name: mq-prod
        spec:
          containers:
          - env:
            - name: RABBITMQ_DEFAULT_VHOST
              value: mymq_vhost
            - name: RABBITMQ_DEFAULT_USER
              value: guest
            - name: RABBITMQ_DEFAULT_PASS
              value: guest  	  
            name: mq-prod
            image: ${mirror_store}/base/${base_version}
            imagePullPolicy: IfNotPresent		# Always、Never、IfNotPresent
            ports:
            - containerPort: 80
            volumeMounts:
            - name: storage
              mountPath: /var/lib/rabbitmq	
            resources:
              limits:
                cpu: "1000m"
                memory: 4096Mi
              requests:
                cpu: "1000m"
                memory: 4096Mi
            securityContext:
              capabilities:
                add:
                - SYS_PTRACE  
          securityContext:
            fsGroup: 999
            runAsUser: 999            
          volumes:
          - name: storage
            persistentVolumeClaim:
              claimName: mq-prod  		
    EOF
    
    cat > mq-prod-svc.yaml << EOF
    kind: Service
    apiVersion: v1
    metadata:
      annotations:
        prometheus.io/probe: "true"
      name: mq-prod
      namespace: mytest
      labels:
        name: mq-prod
    spec:
      ports:
      - name: mq
        nodePort: 31629
        port: 5672
        protocol: TCP
        targetPort: 5672
      - name: tmq
        nodePort: 31630
        port: 15672
        protocol: TCP
        targetPort: 15672
      selector:
       name: mq-prod
      type: NodePort
    EOF
    
    
    
    • 生成配置文件
    _kubectl='/opt/kubernetes/client/bin/kubectl --kubeconfig=/opt/kubernetes/config_prod'
    ${_kubectl} apply -f mq-prod-pvc-pv.yaml
    ${_kubectl} apply -f mq-prod-deployment.yaml
    ${_kubectl} apply -f mq-prod-svc.yaml
    
    
  • 相关阅读:
    LeetCode(81): 搜索旋转排序数组 II
    2018年6月8日论文阅读
    LeetCode(80):删除排序数组中的重复项 II
    LeetCode(79): 单词搜索
    LeetCode(78):子集
    LeetCode(77):组合
    LeetCode(76): 最小覆盖子串
    LeetCode(75):分类颜色
    LeetCode(74):搜索二维矩阵
    linux 两个查找工具 locate,find
  • 原文地址:https://www.cnblogs.com/lixinliang/p/14709034.html
Copyright © 2020-2023  润新知