简体   繁体   English

Kubernetes RC 等到 pod 准备好再缩小规模

[英]Kubernetes RC wait until pod is ready before scaling down

I have a ruby on rails app on kubernetes.我在 kubernetes 上有一个 ruby​​ on rails 应用程序。

Here's what I do这就是我所做的

  1. kubernetes rolling-update new_file kubernetes 滚动更新new_file

  2. Kubernetes began to create new pods Kubernetes 开始创建新的 Pod

  3. When the new pods are ready, Kubernetes kills the old pod.当新的 pod 准备好时,Kubernetes 会杀死旧的 pod。

However, although my new pod are in ready state, they are actually doing rails assets build/compressing.然而,尽管我的新 pod 处于就绪状态,但它们实际上是在进行 Rails 资产构建/压缩。 They aren't ready yet.他们还没有准备好。 How can I let kubernetes know that it's not ready yet?我如何让 kubernetes 知道它还没有准备好?

This sounds like a prime example for a readiness probe: It tells Kubernetes to not take a pod into load balancing until a certain condition holds, often an HTTP endpoint that returns positively.这听起来像是准备就绪探测的一个主要示例:它告诉 Kubernetes 在特定条件成立之前不要将 pod 纳入负载平衡,通常是一个 HTTP 端点返回积极。 Here's an example probe defined along a Deployment specification:以下是根据部署规范定义的示例探针:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx
spec:
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
        readinessProbe:
          httpGet:
            path: /index.html
            port: 80
          initialDelaySeconds: 30    
          timeoutSeconds: 1

See the user guide for a starter and follow-up links contained.请参阅用户指南以获取包含的入门和后续链接。

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

相关问题 在缩小 Kubernetes 上的 pod 之前等待干净关闭 - Wait for clean shutdown before scaling down a pod on Kubernetes Kubernetes - 等待其他 pod 准备就绪 - Kubernetes - wait for other pod to be ready 在终止 kubernetes 中的 pod 之前等待进程完成 - Wait for process to complete before terminating the pod in kubernetes 在使用pod之前是否有kubernetes config parm(service或rc或其他)延迟 - Is there a kubernetes config parm (service or rc or other) to delay before using a pod Kubernetes 吊舱未就绪 - Kubernetes pod not READY 如何保持等待 pod 终止,直到 kubernetes 中的当前进程完成? - How to keep wait pod termination until current processes done in kubernetes? 在从服务端点移除之前让 Kubernetes 等待 Pod 终止 - Make Kubernetes wait for Pod termination before removing from Service endpoints 使用 Kubernetes 有没有办法在更新之前等待 pod 完成其正在进行的任务? - With Kubernetes Is there a way to wait for a pod to finish its ongoing tasks before updating it? 在 Kubernetes 中,如何等待一个 pod 完成删除后再开始新的 - In Kubernetes, how to wait for a pod to finish deleting before starting new one Pod 副本在 Kubernetes Horizo​​ntal Pod Autoscaler 中如何缩减? - How does pod replica scaling down work in Kubernetes Horizontal Pod Autoscaler?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM