edgemesh icon indicating copy to clipboard operation
edgemesh copied to clipboard

edge node cannot access the service with clusterip

Open seven-07-11 opened this issue 3 years ago • 11 comments

kubernetes1.20 kubeedge1.8.2 edgemesh:last kube-proxy and coredns not scheduling in edge node,edgemesh deployment successful

I can't access services through podip or service

seven-07-11 avatar Apr 07 '22 06:04 seven-07-11

Can cloud services be accessed from edge nodes? How to configure? Is there a correct configuration tutorial

seven-07-11 avatar Apr 07 '22 06:04 seven-07-11

M%G5 MGHVNCMD(Q}UWAILTB edgemesh-server log 592IC25504XMC0_~G $PCNFcloudcore log imageedgecore log imageedgecore log

seven-07-11 avatar Apr 07 '22 06:04 seven-07-11

need some edgemesh-agent log

Poorunga avatar Apr 07 '22 06:04 Poorunga

I can't access services through podip or service

edgemesh only support access services by clusterip or services DNS name.

Poorunga avatar Apr 07 '22 07:04 Poorunga

I can't access services through podip or service

edgemesh only support access services by clusterip or services DNS name.

Sorry for my late reply, I access service through clusterip, but there was no response. There was no problem accessing in the cloud node image

edgemesh-agent-master log 3~T5Y5}BOXB)$ )X@@Q}3DR

edgemesh-server log Q5O2GA0549QL9N`(WQZ5_FB

edgemesh-agent-slaver F9PRCJ$KBPKHO6D4{)5BT`5

edgemesh-agent-edge log image

seven-07-11 avatar Apr 07 '22 10:04 seven-07-11

I use binary to deploy kubeedge, Using helm to deploy edgemesh, the configuration of edgemesh has not been modified after successful deployment. Do I need to modify it?Or Kube proxy and coredns? %Z(QOGD2Q4IJ(U4FA7(UNFF

seven-07-11 avatar Apr 07 '22 11:04 seven-07-11

I also found a problem. When deleting the service endpoint, I can access the service through clusterip: curl (52) empty reply from server However, when the endpoint exists, I can access the service directly through podid, but I cannot access the service through clusterip image

seven-07-11 avatar Apr 07 '22 11:04 seven-07-11

The service whose cluster ip is 10.96.0.1 is a very special service. This is a service automatically created by k8s to access the kube apiserver. It is also an external service, and if you want to access it at the edge, some additional configuration is required.

Poorunga avatar Apr 07 '22 11:04 Poorunga

Let's start with some simple services, you can refer to edgemesh's test case: https://edgemesh.netlify.app/guide/test-case.html

Poorunga avatar Apr 07 '22 11:04 Poorunga

The service whose cluster ip is 10.96.0.1 is a very special service. This is a service automatically created by k8s to access the kube apiserver. It is also an external service, and if you want to access it at the edge, some additional configuration is required.

I deployed the joint inference service of Sedna. Edge needs to access port 5000 of cloud, but it cannot be accessed through clusterip. DNS resolution is normal In the service test case, I deployed TCP test, and the service endpoint was deployed on edge node The pod in edge can be accessed, but the pod in cloud cannot

cross-edge-cloud test failed, and no other services were tested. It is certain that there is a problem with Edge and cloud communication. Can you infer the cause of the problem?

seven-07-11 avatar Apr 07 '22 11:04 seven-07-11

@seven-07-11 How to fix your problem:

CLOUD_NODE="cloud-node-name"
EDGE_NODE="edge-node-name"


kubectl create -f - <<EOF
apiVersion: sedna.io/v1alpha1
kind: JointInferenceService
metadata:
  name: helmet-detection-inference-example
  namespace: default
spec:
  edgeWorker:
    model:
      name: "helmet-detection-inference-little-model"
    hardExampleMining:
      name: "IBT"
      parameters:
        - key: "threshold_img"
          value: "0.9"
        - key: "threshold_box"
          value: "0.9"
    template:
      spec:
        nodeName: $EDGE_NODE
        dnsPolicy: ClusterFirstWithHostNet       <----------- LOOK AT HERE!!!
        containers:
        - image: kubeedge/sedna-example-joint-inference-helmet-detection-little:v0.3.0
          imagePullPolicy: IfNotPresent
          name:  little-model
          env:  # user defined environments
          - name: input_shape
            value: "416,736"
          - name: "video_url"
            value: "rtsp://localhost/video"
          - name: "all_examples_inference_output"
            value: "/data/output"
          - name: "hard_example_cloud_inference_output"
            value: "/data/hard_example_cloud_inference_output"
          - name: "hard_example_edge_inference_output"
            value: "/data/hard_example_edge_inference_output"
          resources:  # user defined resources
            requests:
              memory: 64M
              cpu: 100m
            limits:
              memory: 2Gi
          volumeMounts:
            - name: outputdir
              mountPath: /data/
        volumes:   # user defined volumes
          - name: outputdir
            hostPath:
              # user must create the directory in host
              path: /joint_inference/output
              type: Directory

  cloudWorker:
    model:
      name: "helmet-detection-inference-big-model"
    template:
      spec:
        nodeName: $CLOUD_NODE
        containers:
          - image: kubeedge/sedna-example-joint-inference-helmet-detection-big:v0.3.0
            name:  big-model
            imagePullPolicy: IfNotPresent
            env:  # user defined environments
              - name: "input_shape"
                value: "544,544"
            resources:  # user defined resources
              requests:
                memory: 2Gi
EOF

This is a k8s knowledge, if your pod is a host network, you need to configure dnsPolicy like dnsPolicy: ClusterFirstWithHostNet . You can get more information from the kubernetes docs: https://kubernetes.io/zh/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy

Poorunga avatar Apr 08 '22 06:04 Poorunga

I have a similar issue. Cloud -> Edge connection is okay, but edge -> cloud works only for resolving and that is all. After that I've just an error: Connection closed by foreign host

dzubchik avatar Apr 05 '24 17:04 dzubchik