astroctl infra kubernetes upgrade
Upgrade cluster Kubernetes version
Synopsis
Upgrade a cluster's Kubernetes version.
This operation is IRREVERSIBLE - the control plane cannot be downgraded. Server enforces: no version skipping, no downgrades.
SAFETY CHECKS
A real upgrade always runs the readiness report first, shows the plan and the report, then decides. The upgrade does not start when:
- the readiness report says the upgrade cannot proceed
- any preflight check fails
- the report lists a critical issue
- the cluster is not in a ready state
- the target skips a minor version
--yes only skips the confirmation prompt, and only when nothing blocks. --dry-run and --generate-report run the same checks without upgrading, and fail when the upgrade would be blocked. With -o json or -o yaml they print AstroPulse's response (plan, checks, readiness report) as one document.
The control plane is upgraded first, then every node group, one group after another, then (on EKS) the managed add-ons.
ROLLING UPDATE STRATEGY
The --max-surge and --max-unavailable flags control how nodes are upgraded:
--max-surge: Extra nodes created DURING upgrade (requires additional capacity)
--max-unavailable: Nodes that can be DOWN during upgrade (reduces capacity)
These settings are applied PER NODE GROUP. Example with 3 node groups:
Cluster: my-cluster
├── ng-system: 3 nodes (critical) → maxSurge=1, maxUnavailable=0
├── ng-app: 10 nodes (general) → maxSurge=2, maxUnavailable=1
└── ng-workers: 20 nodes (batch) → maxSurge=10%, maxUnavailable=10%
UPGRADE PROCESS (each node group upgraded sequentially):
1. ng-system: Creates 1 extra node, drains old → needs 4 nodes temporarily
2. ng-app: Creates 2 extra, drains 3 at a time → needs 12 nodes temporarily
3. ng-workers: Creates 2 extra (10% of 20), drains 2 → needs 22 nodes temporarily
TOTAL CAPACITY NEEDED: max(4, 12, 22) = 22 nodes at peak
EKS
Managed node groups are upgraded one after another, each by AWS's own
rolling update, which adds replacement nodes first. --max-unavailable of 1
or more (or a percentage) is set on each group before it upgrades; 0 keeps
the group's own setting. --max-surge does not apply to EKS managed node
groups: AWS adds the replacement nodes itself, and the upgrade says so.
Nodes Karpenter provisions are not part of this step: they follow the new
control-plane version and roll on their own under their NodePool's budget.
A PodDisruptionBudget that blocks an eviction stops the upgrade of that
group with the reason; pods are never forced off.
RECOMMENDED STRATEGIES
PRODUCTION (default - extra capacity needed):
--max-surge 1 --max-unavailable 0
Creates 1 extra node, zero downtime, needs N+1 nodes per group
COST-SENSITIVE (no extra capacity needed):
--max-surge 0 --max-unavailable 1
No extra nodes, upgrades in-place, temporary reduced capacity
FAST UPGRADE (more parallelism, more capacity):
--max-surge 25% --max-unavailable 0
Creates 25% extra nodes, faster but needs more capacity
For other changes (scaling, provider settings), use:
astroctl infra k8s update prod-01 -f update.yaml
astroctl infra k8s scale prod-01 workers --min 1 --max 5
astroctl infra kubernetes upgrade <cluster-name> [version] [flags]
Examples
# List available versions for upgrade
astroctl infra k8s upgrade my-cluster --list-versions
# Upgrade to Kubernetes 1.30 (uses production-safe defaults)
astroctl infra k8s upgrade my-cluster 1.30
# Preview upgrade without applying
astroctl infra k8s upgrade my-cluster 1.30 --dry-run
# Generate upgrade readiness report (includes capacity analysis)
astroctl infra k8s upgrade my-cluster 1.30 --generate-report
# Print AstroPulse's plan and readiness report as JSON
astroctl infra k8s upgrade my-cluster 1.30 --dry-run -o json
# Skip the confirmation prompt (safety checks still run and still block)
astroctl infra k8s upgrade my-cluster 1.30 --yes
# PRODUCTION: Safe upgrade with zero downtime (default)
# Creates 1 extra node per group, needs extra capacity
astroctl infra k8s upgrade my-cluster 1.30 --max-surge 1 --max-unavailable 0
# COST-SENSITIVE: No extra capacity needed (slower)
# Upgrades in-place, one node at a time
astroctl infra k8s upgrade my-cluster 1.30 --max-surge 0 --max-unavailable 1
# FAST: Parallel upgrades (needs more capacity)
# Upgrades 25% of nodes at a time
astroctl infra k8s upgrade my-cluster 1.30 --max-surge 25% --max-unavailable 0
# BALANCED: Mix of surge and unavailable
astroctl infra k8s upgrade my-cluster 1.30 --max-surge 1 --max-unavailable 1
Options
--dry-run Preview upgrade without applying changes
--generate-report Generate comprehensive upgrade readiness report
-h, --help help for upgrade
--list-versions List available Kubernetes versions for this cluster
--max-surge string Maximum number of nodes (or percentage like '25%') that can be created above desired count during rolling update (not applicable to EKS managed node groups)
--max-unavailable string Maximum number of nodes (or percentage like '25%') that can be unavailable during rolling update
-o, --output string Output format for the upgrade report (json, yaml, markdown); with --dry-run or --generate-report, json or yaml prints AstroPulse's response as one document (default "json")
--yes Skip the confirmation prompt (never skips safety checks)
SEE ALSO
- astroctl infra kubernetes - Manage Kubernetes clusters