Skip to main content

astroctl infra kubernetes update

Update cluster configuration via YAML

Synopsis​

Update cluster configuration via YAML file.

For K8s version upgrades:

Terminal
astroctl infra k8s upgrade my-cluster --list-versions # See available versions
astroctl infra k8s upgrade my-cluster 1.33 # Upgrade

For K8s version rollback (node pools only, control plane cannot be downgraded):

Terminal
astroctl infra k8s rollback my-cluster --list-versions # See rollback versions
astroctl infra k8s rollback my-cluster 1.32 # Rollback

For node group scaling:

Terminal
astroctl infra k8s scale my-cluster --list # See node groups
astroctl infra k8s scale my-cluster workers --min 1 --max 5

To remove a node group (any nodes it has are drained first):

Terminal
astroctl infra k8s update my-cluster --remove-node-group gpu-serving

Whether a group can be removed, and why not, is under workerNodes[].removal in:

Terminal
astroctl infra k8s get my-cluster -o yaml

For complex/provider-specific updates, use this command with a YAML file.

The file can also be the cluster's spec, as 'astroctl infra k8s spec' prints it: edit it and apply it back. Only what differs from the cluster's spec now is sent. A changed node group (matched by name) is sent whole, unchanged ones are not sent, and a new name creates a group. The Kubernetes version is sent when it changed. A node group left out of the file is not removed; remove one with --remove-node-group. The fields that identify the cluster (name, provider, region, provisioner type, account) must match it. Changed tags (labels on GKE) are sent as the cluster's whole set, and any other changed field is refused: make that change with a K8sClusterUpdate. A value you leave as it is in the file is never sent.

VALID OPTIONS:

Terminal
EKS amiFamily: AmazonLinux2023, Bottlerocket, Ubuntu2004, Ubuntu2204, Ubuntu2404, Ubuntu2604, UbuntuPro2004, UbuntuPro2204, UbuntuPro2404, UbuntuPro2604
GKE imageType: COSContainerd, UbuntuContainerd
GKE releaseChannel: Stable, Regular, Rapid
AKS autoUpgrade: Stable, Patch, Rapid, NodeImage, None
AKS nodeOsUpgrade: NodeImage, SecurityPatch, Unmanaged, None
GKE maintenance: a daily start time, HH:MM in UTC, such as 03:00
Terminal
astroctl infra kubernetes update <cluster-name> [flags]

Examples​

Terminal
# Edit the cluster's spec and apply it back (unchanged, it changes nothing)
astroctl infra k8s spec my-cluster > my-cluster.yaml
astroctl infra k8s update my-cluster -f my-cluster.yaml --dry-run
astroctl infra k8s spec my-cluster | astroctl infra k8s update my-cluster -f - --dry-run

# Scale node groups
cat <<EOF | astroctl infra k8s update my-cluster -f -
apiVersion: platform.astropulse.io/v1
kind: K8sClusterUpdate
spec:
nodeGroups:
- name: ng-1
minNode: 3
maxNode: 10
EOF

# Remove a node group: its nodes are drained, then the group is deleted
astroctl infra k8s update my-cluster --remove-node-group gpu-serving --dry-run

# The same in a manifest
cat <<EOF | astroctl infra k8s update my-cluster -f -
apiVersion: platform.astropulse.io/v1
kind: K8sClusterUpdate
spec:
removeNodeGroups:
- gpu-serving
EOF

# Upgrade Kubernetes version: the control plane, then every node group
cat <<EOF | astroctl infra k8s update my-cluster -f -
apiVersion: platform.astropulse.io/v1
kind: K8sClusterUpdate
spec:
kubernetesVersion: "1.33" # astroctl cloud gcp k8s-versions
EOF

# GKE: Change image type and release channel
cat <<EOF | astroctl infra k8s update my-cluster -f -
apiVersion: platform.astropulse.io/v1
kind: K8sClusterUpdate
spec:
gke:
imageType: UbuntuContainerd
releaseChannel: Stable
EOF

# EKS: Change AMI family
cat <<EOF | astroctl infra k8s update my-cluster -f -
apiVersion: platform.astropulse.io/v1
kind: K8sClusterUpdate
spec:
eks:
amiFamily: Bottlerocket
EOF

# AKS: Update upgrade channels
cat <<EOF | astroctl infra k8s update my-cluster -f -
apiVersion: platform.astropulse.io/v1
kind: K8sClusterUpdate
spec:
aks:
autoUpgradeChannel: Stable
nodeOsUpgradeChannel: NodeImage
EOF

# Dry-run (validate without applying)
astroctl infra k8s update my-cluster -f update.yaml --dry-run

# Replace an update that is still running (for example one retrying a node
# group that can't be created): it is cancelled, removes the node groups it
# was adding, and this change starts once it has stopped
astroctl infra k8s update my-cluster -f update.yaml --replace-running

# Dry-run, printing AstroPulse's response (plan, checks, verdict) as JSON
astroctl infra k8s update my-cluster -f update.yaml --dry-run -o json

# Show all YAML examples
astroctl infra k8s update my-cluster --example

Options​

Terminal
--auto-approve Skip confirmation prompt and apply updates immediately
--dry-run Perform a dry-run validation without applying changes
--example Show YAML examples for this cluster's provisioner
-f, --file string YAML file: a K8sClusterUpdate, or the cluster's spec from 'astroctl infra k8s spec'. Use '-' to read from stdin.
-h, --help help for update
--remove-node-group stringArray Name of a node group to remove: its nodes are drained, then the group is deleted. Repeat to remove several.
--replace-running If an update is still running on the cluster, cancel it and start this change once it has stopped. The cancel removes the node groups the running update was adding.

Options inherited from parent commands​

Terminal
-o, --output string Output format (table|json|yaml) (default "table")

SEE ALSO​