大网数据广告活动
服务器运维问答

Kubernetes: Updating a Deployment Image with a TLS Ingress Resource

· 52CE 我爱测

I'm attempting to update the image for my Deployment. To this I am executing kubectl edit deployment web and am changing the spec.template.spec.containers.image property from: gcr.io/my-project-id-1234/app:v1 To: gcr.io/my-projec…

问题原文

原帖链接 · mjc · CC BY-SA 3.0

I'm attempting to update the image for my Deployment. To this I am executing kubectl edit deployment web and am changing the spec.template.spec.containers.image property from:

gcr.io/my-project-id-1234/app:v1

To:

gcr.io/my-project-id-1234/app:v2

From the logs, I know the deployment updates fine. The problem I'm having is with the TLS ingress; here is my configuration:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: tls-ingress
spec:
  tls:
    - secretName: tls-secrets
  backend:
    serviceName: web
    servicePort: 80

And here is the result of kubectl describe ing web prior to the update:

$ kubectl describe ing                                                                                                                                                          
Name:                   tls-ingress
Namespace:              default
Address:                105.78.154.212
Default backend:        web:80 (10.0.2.3:8000)
TLS:
  tls-secrets terminates 
Rules:
  Host  Path    Backends
  ----  ----    --------
Annotations:
  backends:                     {"k8s-be-32171":"HEALTHY"}
  forwarding-rule:              k8s-fw-default-tls-ingress
  https-forwarding-rule:        k8s-fws-default-tls-ingress
  https-target-proxy:           k8s-tps-default-tls-ingress
  static-ip:                    k8s-fw-default-tls-ingress
  target-proxy:                 k8s-tp-default-tls-ingress
  url-map:                      k8s-um-default-tls-ingress

Before the update everything works correctly. But shortly traffic stops being successfully routed to my cluster. Describing the ingress now returns:

Name:                   tls-ingress
Namespace:              default
Address:                105.78.154.212
Default backend:        web:80 (10.0.2.3:8000)
TLS:
  tls-secrets terminates 
Rules:
  Host  Path    Backends
  ----  ----    --------
Annotations:
  static-ip:                    k8s-fw-default-tls-ingress
  target-proxy:                 k8s-tp-default-tls-ingress
  url-map:                      k8s-um-default-tls-ingress
  backends:                     {"k8s-be-32171":"UNHEALTHY"}
  forwarding-rule:              k8s-fw-default-tls-ingress
  https-forwarding-rule:        k8s-fws-default-tls-ingress
  https-target-proxy:           k8s-tps-default-tls-ingress

How do I properly update the Ingress when updating my Deployment like so?

已采纳解答

原帖链接 · MDrollette · CC BY-SA 3.0

The Ingress points at a Service. The Service points at a set of Pods having some labels. The Deployment defines those labels on the Pods. Here's a list of what to troubleshoot:

  1. Confirm the label selector on your Service matches the labels on the Pods your Deployment is creating. Otherwise the Pods created by the Deployment won't be selected for the Service and your Ingress will be pointing at nothing.

  2. Confirm the Service is exposed as a NodePort. Otherwise the external Load Balancer from Google won't be able to reach inside your cluster.

  3. Confirm the Pods are running/healthy. It's possible for a Deploymentto be updated but the Pods be unhealthy or in a CrashLoop. It's important for the application to respond with a 200 status code for GET /.

  4. Create a firewall rule for the health-checks:

    gcloud compute firewall-rules create allow-130-211-0-0-22 \
      --source-ranges 130.211.0.0/22 \
      --allow tcp:30000-32767
    

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-05-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。