You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用kubectl查看Deployment历史版本的详细信息?

How to View Detailed Rollout History for a Kubernetes Deployment

Great question! I’ve faced this exact frustration before—seeing just version numbers in kubectl rollout history gives you zero context to decide which version to roll back to. Here are the key commands and tips to get the detailed info you need:

1. Inspect a Specific Revision’s Full Details

To dive into the complete configuration of a single revision, add the --revision flag to your history command, specifying the version number you want to check:

kubectl rollout history deployment/myDeployment --revision=2

This will output the full spec of that Deployment revision, including:

  • Container image versions
  • Resource requests/limits
  • Environment variables
  • Annotations (including any change cause notes)
  • Pod template configurations

2. Quick Comparison of All Revisions (Custom Columns)

If you want a high-level overview of all revisions side-by-side (like comparing image versions across every rollout), use a custom column output to extract specific fields:

kubectl rollout history deployment/myDeployment -o custom-columns='REVISION:.revision,IMAGE:.spec.template.spec.containers[0].image,CHANGE CAUSE:.metadata.annotations.kubernetes\.io/change-cause'

You can adjust the columns to include whatever fields matter most to you—swap IMAGE for .spec.replicas to track replica count changes, or add .spec.template.spec.nodeSelector to check node placement updates.

3. Add Context to Future Rollouts

To make your rollout history more useful going forward, document changes explicitly:

  • In newer Kubernetes versions (where --record is deprecated), add a custom annotation when updating your Deployment:
    kubectl set image deployment/myDeployment mycontainer=myimage:v3 --annotations kubernetes.io/change-cause="Updated to v3: fixed API timeout bug"
    
    This annotation will show up in your rollout history, giving you instant context for each revision without needing to dig into full specs.

内容的提问来源于stack exchange,提问作者Satyajit Das

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 17:27:27