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

标签 azure docker kubernetes

我正在关注这个文档。

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

CICD 管道工作正常。但我想使用部署到 Kubernete 集群的外部 IP 来验证应用程序。

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

容器详细信息

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>

服务详情:

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>

我正在点击以下网址,但请求超时。 http://52.163.191.28:88/

有人可以帮忙吗?如果您需要更多详细信息,请告诉我。

最佳答案

对于你的问题,我做了一个测试,它在我这边有效。此处的 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

还有一些需要注意的地方。

  1. 您应该确保服务在容器中监听哪个端口。例如,在我的测试中,nginx服务默认监听80端口。
  2. 您想要在节点中公开的端口应该处于空闲状态。换句话说,该端口没有被其他服务使用。
  3. 当所有步骤完成后。您可以使用您在节点中暴露的端口访问公共(public)IP。

截图显示了我的测试结果:

enter image description here enter image description here

希望这对您有帮助!

关于azure - 无法使用 Azure CICD Pipeline 访问部署在 Azure ACS Kubernetes 群集中的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53184381/

相关文章:

docker - Kubernetes-将多个镜像部署到单个Pod中

java - 我们可以用JAVA触发队列来编写Azure Webjobs吗

azure - 如何在 ARM 模板的参数内引用参数?

node.js - Docker Nodejs多阶段构建错误。找不到距离

docker - 在docker上部署Node.js

laravel - kubernetes 上的 snipeit 未运行

kubernetes - 无法在 Kubernetes 中删除有状态集

linux - --cap-add=NET_ADMIN 与在 .yml 中添加功能之间的区别

azure - Microsoft.Compute/virtualMachines/extensions' 的段长度不正确

c# - Azure 服务总线主题超时异常