简体   繁体   English

无法使用Azure CICD管道访问部署在Azure ACS Kubernetes群集中的应用程序

[英]Cannot access application deployed in Azure ACS Kubernetes Cluster using Azure CICD Pipeline

I am following this document. 我正在关注这份文件。

https://github.com/Azure/DevOps-For-AI-Apps/blob/master/Tutorial.md https://github.com/Azure/DevOps-For-AI-Apps/blob/master/Tutorial.md

The CICD pipeline works fine. CICD管道运行良好。 But I want to validate the application using the external ip that is being deployed to Kubernete cluster. 但是我想使用部署到Kubernete集群的外部ip验证应用程序。

Deploy.yaml Deploy.yaml

apiVersion: v1
kind: Pod
metadata:
 name: imageclassificationapp
spec:
 containers:
   - name: model-api
     image: crrq51278013.azurecr.io/model-api:156
     ports:
       - containerPort: 88
 imagePullSecrets:
   - name: imageclassificationappdemosecret

Pod details 吊舱详细信息

C:\Users\nareshkumar_h>kubectl describe pod imageclassificationapp
Name:         imageclassificationapp
Namespace:    default
Node:         aks-nodepool1-97378755-2/10.240.0.5
Start Time:   Mon, 05 Nov 2018 17:10:34 +0530
Labels:       new-label=imageclassification-label
Annotations:  kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"name":"imageclassificationapp","namespace":"default"},"spec":{"containers":[{"image":"crr...
Status:       Running
IP:           10.244.1.87
Containers:
  model-api:
    Container ID:   docker://db8687866d25eb4311175c5ccb5a7205379168c64cdfe716b09557fc98e2bd6a
    Image:          crrq51278013.azurecr.io/model-api:156
    Image ID:       docker-pullable://crrq51278013.azurecr.io/model-api@sha256:766673989a59fe0b1e849469f38acda96853a1d84e4b4d64ffe07810dd5d04e9
    Port:           88/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 05 Nov 2018 17:12:49 +0530
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-qhdjr (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          True
  PodScheduled   True
Volumes:
  default-token-qhdjr:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-qhdjr
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          <none>

Service details: 服务详情:

C:\Users\nareshkumar_h>kubectl describe service imageclassification-service
Name:                     imageclassification-service
Namespace:                default
Labels:                   run=load-balancer-example
Annotations:              <none>
Selector:                 run=load-balancer-example
Type:                     LoadBalancer
IP:                       10.0.24.9
LoadBalancer Ingress:     52.163.191.28
Port:                     <unset>  88/TCP
TargetPort:               88/TCP
NodePort:                 <unset>  32672/TCP
Endpoints:                10.244.1.65:88,10.244.1.88:88,10.244.2.119:88
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

I am hitting the below url but the request times out. 我点击以下网址,但请求超时。 http://52.163.191.28:88/ http://52.163.191.28:88/

Can some one please help? 有人可以帮忙吗? Please let me know if you need any further details. 如果您需要更多详细信息,请告诉我。

For your issue, I did a test and it worked in my side. 对于您的问题,我进行了测试,它可以正常工作。 The yaml file here: yaml文件在这里:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
---

apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  type: LoadBalancer
  ports:
  - port: 88
    targetPort: 80
  selector:
    app: nginx

And there are some points should pay attention to. 并且有一些要注意的地方。

  1. You should make sure which port the service listen to in the container. 您应该确保服务在容器中侦听哪个端口。 For example, in my test, the nginx service listens to port 80 default. 例如,在我的测试中,nginx服务监听默认的端口80。
  2. The port that you want to expose in the node should be idle. 您要在节点中公开的端口应为空闲状态。 In other words, the port was not used by other services. 换句话说,该端口未被其他服务使用。
  3. When all the steps have done. 完成所有步骤后。 You can access the public IP with the port you have exposed in the node. 您可以使用节点中公开的端口访问公共IP。

The screenshots show the result of my test: 屏幕截图显示了我的测试结果:

在此处输入图片说明 在此处输入图片说明

Hope this will help you! 希望这个能对您有所帮助!

We are able to solve this issue after reconfiguring Kubernetes Service with Right configuration and changing deploy.yaml file as follows - 在使用正确的配置重新配置Kubernetes Service并按以下方式更改deploy.yaml文件后,我们能够解决此问题-

apiVersion: apps/v1beta1
kind: Deployment 
metadata: 
name: imageclassificationapp 
spec: 
  selector: 
   matchLabels: 
     app: imageclassificationapp 
replicas: 1 # tells deployment to run 2 pods matching the template 
template:
 metadata: 
  labels: 
    app: imageclassificationapp 
spec: 
   containers: 
    - name: model-api 
     image: crrq51278013.azurecr.io/model-api:205
     ports: 
     - containerPort: 88
---
apiVersion: v1
kind: Service   
metadata:   
  name: imageclassificationapp  
spec:   
 type: LoadBalancer 
 ports: 
 - port: 85
 targetPort: 88 
selector:   
 app: imageclassificationapp

We can close this thread now. 我们现在可以关闭该线程。

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

相关问题 无法访问部署在 Azure ACS Kubernetes 集群中的 Web API - Cannot access Web API deployed in Azure ACS Kubernetes Cluster 使用Azure 2.0 CLI设置Azure Kubernetes ACS群集 - Provision Azure Kubernetes ACS cluster using Azure 2.0 CLI Azure AKS - 无法从部署在 Cluster1 中 Pod1 上的另一个应用程序访问部署在 Cluster2 中 Pod2 上的应用程序 - Azure AKS - Cannot access application deployed on a Pod2 in Cluster2 from another application deployed on Pod1 in Cluster1 使用NodePort访问Azure Kubernetes集群 - access azure kubernetes cluster using a NodePort 在Azure Kubernetes服务(AKS)上部署的Web应用程序的访问日志生成 - Access Log generation of deployed web application on Azure Kubernetes Service (AKS) ACS天蓝色已发布的应用程序 - ACS azure for published application Azure ACS(Kubernetes)的Alpha选项 - Alpha options for Azure ACS (Kubernetes) 使用未部署在 Azure 中的应用程序访问 Azure Key Vault 存储的机密 - Access Azure Key Vault stored secret using application not deployed in Azure Azure ACS Kubernetes Windows Containers延迟了对Internet的访问 - Azure ACS Kubernetes Windows Containers delayed access to internet Azure kubernetes - 如何调试部署的应用程序? - Azure kubernetes - How to debug the application deployed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM