简体   繁体   English

Kubernetes服务-无法访问服务IP地址

[英]Kubernetes service - service IP address is not accessible

I am working with aks service. 我正在使用aks服务。 I have a Tensorflow serving image at azure container registry. 我在Azure容器注册表中有一个Tensorflow服务映像。 Now when I deploy my service, the public service endpoint is not accessible neither is it pingable. 现在,当我部署服务时,公共服务终结点不可访问,也无法ping通。

My image is exposed at port 8501 , so I am using it as a target port in my yaml. 我的映像在端口8501处公开,因此我将其用作yaml中的目标端口。

Here is the yaml file I am using for this deployment. 这是我用于此部署的yaml文件。

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-model-gpu
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: my-model-gpu
    spec:
      containers:
      - name: my-model-gpu
        image: dsdemocr.azurecr.io/work-place-safety-gpu
        ports:
        - containerPort: 8501
        resources:
         limits:
           nvidia.com/gpu: 1
      imagePullSecrets:
        - name: registrykey

---
apiVersion: v1
kind: Service
metadata:
  name: my-model-gpu
spec:
  type: LoadBalancer
  ports:
  - port: 8501
    protocol: "TCP"
    targetPort: 8501
  selector:
    app: my-model-gpu

below are my svc description : kubectl describe svc my-model-gpu 以下是我的svc说明: kubectl describe svc my-model-gpu

Name:                     my-model-gpu
Namespace:                default
Labels:                   <none>
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"my-model-gpu","namespace":"default"},"spec":{"ports":[{"port":850...
Selector:                 app=my-model-gpu
Type:                     LoadBalancer
IP:                       10.0.244.106
LoadBalancer Ingress:     52.183.17.101
Port:                     <unset>  8501/TCP
TargetPort:               8501/TCP
NodePort:                 <unset>  31546/TCP
Endpoints:                10.244.0.22:8501
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason                Age   From                Message
  ----    ------                ----  ----                -------
  Normal  EnsuringLoadBalancer  10m   service-controller  Ensuring load balancer
  Normal  EnsuredLoadBalancer   9m8s  service-controller  Ensured load balancer

Looks like I am making some mistake with port mapping. 看起来我在端口映射上犯了一些错误。 Any help is much appreciated. 任何帮助深表感谢。

From the information you provided, there is no problem with the service having the load balancer type. 根据您提供的信息,具有负载均衡器类型的服务没有问题。 As I think, the possible reasons are all about your application and I would list below: 我认为,可能的原因全都与您的申请有关,我将在下面列出:

  1. the port which you expose is not right, so you need to make sure what is the right port to expose. 您公开的端口不正确,因此您需要确保什么是正确的公开端口。
  2. I see you want to use GPU in AKS, so you need to choose the right VM size for GPU in the creation time. 我看到您想在AKS中使用GPU,因此您需要在创建时为GPU选择正确的VM大小 This may also cause the problem that your application not in the running state. 这也可能导致您的应用程序未处于运行状态的问题。
  3. there are other problems happen to your application and it cause your application not run well. 您的应用程序还会发生其他问题,这会导致您的应用程序无法正常运行。 So you also need to check your application state. 因此,您还需要检查您的应用程序状态。
  4. To the imagePullSecret , maybe you do not assign enough permission for the service principal to pull the image. 对于imagePullSecret ,也许您没有为服务主体分配足够的权限来提取图像。 This reason is less likely, but I also list here. 这个原因不太可能,但我也在这里列出。

Hope this helps you. 希望这对您有所帮助。

Please follow the advice provided by community: 请遵循社区提供的建议:

Researching this topic I would suggest to take a look for those Azure specific information: 研究此主题后,我建议您查看一下那些特定于Azure的信息:

If the static IP address defined in the loadBalancerIP property of the Kubernetes service manifest does not exist, or has not been created in the node resource group and no additional delegations configured, the load balancer service creation fails. 如果Kubernetes服务清单的loadBalancerIP属性中定义的静态IP地址不存在,或者尚未在节点资源组中创建,并且未配置任何其他委托,则负载均衡器服务创建失败。

There is very similar case on github . github上有非常相似的情况

If using Advanced networking it creates the vNet in the same resource group as the AKS service by default.

Note: 注意:

Currently only Basic IP SKUis supported. 当前仅支持基本IP SKU。 Work is in progress to support the Standard IP resource SKU. 支持标准IP资源SKU的工作正在进行中。 For more information, see IP address types and allocation methods in Azure . 有关更多信息, 请参见Azure中的IP地址类型和分配方法

Additional resources: 其他资源:

Azure-LoadBalnacer related: Azure-LoadBalnacer相关:

Hope this help. 希望能有所帮助。

我尝试访问的容器在8501上没有打开任何端口,一旦我修复它,它就会很好地工作。

I think you need to access application on 52.183.17.101:8501 我认为您需要在52.183.17.101:8501上访问应用程序

Because you didn't defined the routing the traffic to 80 port of loadbalancer. 因为您没有定义将流量路由到负载均衡器的80端口的路由。 By default it will create loadbalancer listening on 8501. 默认情况下,它将创建监听8501的负载均衡器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法访问 Azure kubernetes 服务负载均衡器外部 IP - Azure kubernetes service loadbalancer external IP not accessible Kubernetes中的节点之间无法访问服务IP - Service IP is not accessible across nodes in kubernetes Kubernetes服务的对外连接IP地址是多少? - What is the external connection IP address of Kubernetes service? 未为 Kubernetes 服务分配(外部)IP 地址 - Kubernetes Service not being assigned an (external) IP address Kubernetes - 服务群集IP地址与Pod IP地址 - Kubernetes - service cluster IP address vs Pod IP address 如何使用服务 IP 地址在 Kubernetes 代替 POD IP 地址 - how to use service IP address at Kubernetes instead of POD IP address Kubernetes服务ip并不总是可以在群集中访问(使用法兰绒) - Kubernetes service ip isn't always accessible within cluster (with flannel) docker swarm服务或Kubernetes服务ClusterIP-将IP地址附加到服务 - docker swarm service or Kubernetes services ClusterIP - attach IP address to service 当上游服务IP更改时,Kubernetes Nginx会刷新IP地址 - Kubernetes nginx refresh ip address when upstream service IP changes 无法访问Kubernetes服务集群ip,但是可以从节点内部访问端点ip - Kubernetes service cluster ip not accessible but endpoints ip is accessible from within the node
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM