• 在k8s集群中部署EdgeMesh


    1. 前置准备

    1.1 移除k8s master节点污点

    如果k8s master节点上没有部署需要被代理的应用,也可以不执行此步骤:

    kubectl taint nodes --all node-role.kubernetes.io/master-

    1.2 给 Kubernetes API 服务添加过滤标签

    正常情况下你不会希望 EdgeMesh 去代理 Kubernetes API 服务,因此需要给它添加过滤标签,更多信息请参考 服务过滤

    kubectl label services kubernetes service.edgemesh.kubeedge.io/service-proxy-name=""

    1.3 启用 KubeEdge 的边缘 Kube-API 端点服务

    1.3.1 在云端开启 dynamicController 模块

    修改cloudcore configmap,需要重启cloudcore pod

    1. $ kubectl edit cm cloudcore -n kubeedge
    2. modules:
    3. ...
    4. dynamicController:
    5. enable: true

    1.3.2 在边缘节点,打开 metaServer 模块(如果你的 KubeEdge < 1.8.0,还需关闭旧版 edgeMesh 模块),配置完成后,需要重启 edgecore

    1. $ vim /etc/kubeedge/config/edgecore.yaml
    2. modules:
    3. ...
    4. edgeMesh:
    5. enable: false
    6. ...
    7. metaManager:
    8. metaServer:
    9. enable: true
    10. ...
    systemctl restart edgecore.service 

    1.3.3  在边缘节点,配置 clusterDNS 和 clusterDomain,配置完成后,需要重启 edgecore

    1. $ vim /etc/kubeedge/config/edgecore.yaml
    2. modules:
    3. ...
    4. edged:
    5. ...
    6. tailoredKubeletConfig:
    7. ...
    8. clusterDNS:
    9. - 169.254.96.16
    10. clusterDomain: cluster.local
    11. ...
    systemctl restart edgecore.service 

    提示

    • 步骤3的配置是为了边缘应用能够访问到 EdgeMesh 的 DNS 服务,与边缘 Kube-API 端点本身无关,但为了配置的流畅性,还是放在这里说明。
    • clusterDNS 设置的值 '169.254.96.16' 来自于 commonConfig在新窗口打开 中 bridgeDeviceIP 的默认值,正常情况下无需修改,非得修改请保持两者一致。

    1.3.4 在边缘节点,测试边缘 Kube-API 端点功能是否正常

    1. curl 127.0.0.1:10550/api/v1/services
    2. {"apiVersion":"v1","items":[{"apiVersion":"v1","kind":"Service","metadata":{"creationTimestamp":"2021-04-14T06:30:05Z","labels":{"component":"apiserver","provider":"kubernetes"},"name":"kubernetes","namespace":"default","resourceVersion":"147","selfLink":"default/services/kubernetes","uid":"55eeebea-08cf-4d1a-8b04-e85f8ae112a9"},"spec":{"clusterIP":"10.96.0.1","ports":[{"name":"https","port":443,"protocol":"TCP","targetPort":6443}],"sessionAffinity":"None","type":"ClusterIP"},"status":{"loadBalancer":{}}},{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"prometheus.io/port":"9153","prometheus.io/scrape":"true"},"creationTimestamp":"2021-04-14T06:30:07Z","labels":{"k8s-app":"kube-dns","kubernetes.io/cluster-service":"true","kubernetes.io/name":"KubeDNS"},"name":"kube-dns","namespace":"kube-system","resourceVersion":"203","selfLink":"kube-system/services/kube-dns","uid":"c221ac20-cbfa-406b-812a-c44b9d82d6dc"},"spec":{"clusterIP":"10.96.0.10","ports":[{"name":"dns","port":53,"protocol":"UDP","targetPort":53},{"name":"dns-tcp","port":53,"protocol":"TCP","targetPort":53},{"name":"metrics","port":9153,"protocol":"TCP","targetPort":9153}],"selector":{"k8s-app":"kube-dns"},"sessionAffinity":"None","type":"ClusterIP"},"status":{"loadBalancer":{}}}],"kind":"ServiceList","metadata":{"resourceVersion":"377360","selfLink":"/api/v1/services"}}

    2. 安装

    2.1 生成PSK cipher

    1. openssl rand -base64 32
    2. WifvEZLmK/bgc8SzhQ/ptZZc/9uZZ0yUsAABCHEdrQ4=

    2.2 部署EdgeMesh

    1. helm install edgemesh --namespace kubeedge \
    2. --set agent.psk=WifvEZLmK/bgc8SzhQ/ptZZc/9uZZ0yUsAABCHEdrQ4= \
    3. --set agent.relayNodes[0].nodeName=k8s-master,agent.relayNodes[0].advertiseAddress="{1.1.1.1}" \
    4. https://github.com/kubeedge/edgemesh/blob/v1.15.0/build/helm/edgemesh.tgz

  • 相关阅读:
    Android---Class 对象在执行引擎中的初始化过程
    SimpleDateFormat严格限制日期转换setLenient(false)
    LeetCode|股票问题|121. 买卖股票的最佳时机、122. 买卖股票的最佳时机 II、123. 买卖股票的最佳时机 III
    Python蓝桥杯---数列求值
    深入浅出Docker:Java开发者的快速上手指南
    [编程基础] Python内置模块collections使用笔记
    SBOM:缓解软件供应链风险的关键
    华为手机怎么开启生产模式 | 华为手机打开生产模式后有驱动没有安装好怎么办 | 华为荣耀9手机打开生产模式后有驱动有叹号怎么办
    多媒体应用设计师 开始
    软件测试面试大全(2023版,答案+文档)
  • 原文地址:https://blog.csdn.net/weixin_41020960/article/details/137966973