astroctl infra kubernetes apply
Apply the cluster configurations to create a new cluster
Synopsis
Create a Kubernetes cluster from a YAML specification file.
apply first shows AstroPulse's checklist for the cluster, the account connection at the top. A failed check stops the command with what to fix; when every check passes, apply asks to confirm, then creates the cluster.
apply never changes a cluster that already exists. Given that cluster's spec ('astroctl infra k8s spec prod-01') unchanged, it reports no changes; given a manifest that differs, it stops and names the 'astroctl infra k8s update' command that makes the change.
Credentials prerequisite: run 'astroctl cloud aws connect' (or gcp, azure) once before creating clusters.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ EKS: AWS Elastic Kubernetes Service ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
apiVersion: platform.astropulse.io/v1
kind: K8sCluster
spec:
clusterName: my-eks-cluster
provider: aws
region: us-east-1 # AWS region (us-east-1, us-west-2, eu-west-1, ...)
clusterSpec:
dataPlane:
nodeGroups:
- name: ng-workers
minNode: 2 # EKS runs the group at minNode; nothing resizes it
maxNode: 2 # EKS: no effect; scale with the karpenter add-on
machineTypes: [t3.medium] # t3.medium | m5.large | c5.2xlarge | p3.2xlarge | ...
instanceType: OnDemand # OnDemand | Spot | Reserved | CapacityBlock (Reserved: eks, gke; CapacityBlock: eks)
# Reserved and CapacityBlock run on capacity the account already holds; AstroPulse never buys it.
# CapacityBlock: an EC2 Capacity Block for ML, active and reserving at least maxNode instances;
# give exactly one machineTypes entry and one availabilityZones entry, the block's own.
availabilityZones: [] # optional: omit to auto-select 3 zones
# labels: {workload: core} # optional: Kubernetes node labels; an empty map is refused
taints: [] # optional: Kubernetes node taints
# A GPU node group (eks, gke, aks; Kubernetes 1.36 or later): name the GPU instead of
# machineTypes and AstroPulse picks the cheapest machine that carries it ('apply --dry-run -o yaml'
# shows the pick under resolvedNodeGroups). Any machineTypes you do list must each carry that GPU.
# GPUs and their per-node counts: astroctl cloud aws accelerators list -r us-east-1
# - name: ng-gpu
# minNode: 1
# maxNode: 1
# instanceType: OnDemand
# accelerator:
# gpu: {vendor: nvidia, model: t4, countPerNode: 1} # vendor is optional
provisioner:
type: eks
eks:
accountId: "123456789012" # 12-digit AWS account ID (required)
kubernetesVersion: "1.33" # optional: omit for latest; astroctl cloud aws k8s-versions
amiFamily: AmazonLinux2023 # optional: AmazonLinux2023 | Bottlerocket | Ubuntu2004 | Ubuntu2204 | Ubuntu2404 | Ubuntu2604 | UbuntuPro2004 | UbuntuPro2204 | UbuntuPro2404 | UbuntuPro2604
computeMode: ManagedNodeGroups # optional: ManagedNodeGroups (default) | AutoMode
credentials:
type: Dynamic # uses 'astroctl cloud aws connect' credentials
# EKS Auto Mode: set computeMode and omit clusterSpec.dataPlane entirely.
# The equivalent convenience override is --eks-compute-mode AutoMode.
provisioner:
type: eks
eks:
computeMode: AutoMode
# autoMode: {enableGpuNodePool: true, gpuLimit: 10} # optional: same GPU switch as the Karpenter add-on
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ GKE: Google Kubernetes Engine ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
apiVersion: platform.astropulse.io/v1
kind: K8sCluster
spec:
clusterName: my-gke-cluster
provider: gcp
region: us-central1 # GCP region (us-central1, europe-west1, asia-east1, ...)
clusterSpec:
dataPlane:
nodeGroups:
- name: ng-workers
minNode: 2
maxNode: 5
machineTypes: [n2-standard-2] # n2-standard-2 | e2-medium | c2-standard-4 | n1-standard-4 | ...
instanceType: OnDemand
availabilityZones: [] # optional: e.g. [us-central1-a, us-central1-b]
# labels: {workload: core} # optional: Kubernetes node labels; an empty map is refused
provisioner:
type: gke
gke:
projectId: my-gcp-project # GCP project ID (required)
kubernetesVersion: "1.33" # optional: omit for the channel default; astroctl cloud gcp k8s-versions
releaseChannel: Stable # optional: Rapid | Regular | Stable (default: Stable)
autopilot: false # optional: true lets GKE manage nodes (pay per pod)
authorizedNetworks: [] # optional: CIDR blocks allowed to reach the API server (max 50)
credentials:
type: Dynamic # uses the 'astroctl cloud gcp connect' connection
# GKE Autopilot: set autopilot and omit clusterSpec.dataPlane entirely.
provisioner:
type: gke
gke:
autopilot: true
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ AKS: Azure Kubernetes Service ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
apiVersion: platform.astropulse.io/v1
kind: K8sCluster
spec:
clusterName: my-aks-cluster
provider: azure
region: eastus # Azure region (eastus, westeurope, southeastasia, ...)
clusterSpec:
dataPlane:
nodeGroups:
- name: ng-workers # AKS: first node group is the system pool (minNode >= 2)
minNode: 2
maxNode: 5
machineTypes: [Standard_D2s_v3] # Standard_D2s_v3 | Standard_B2ms | Standard_D4s_v3 | ...
instanceType: OnDemand
# labels: {workload: core} # optional: Kubernetes node labels; an empty map is refused
provisioner:
type: aks
aks:
subscriptionId: "00000000-0000-0000-0000-000000000000" # Azure subscription UUID (required)
resourceGroup: my-resource-group # Azure resource group (required)
kubernetesVersion: "1.33" # optional: omit for the AKS default; astroctl cloud azure k8s-versions
autoUpgradeChannel: Stable # optional: Patch | Stable | Rapid | NodeImage | None
nodeOsUpgradeChannel: NodeImage # optional: SecurityPatch | NodeImage | None | Unmanaged
authorizedIPRanges: [] # optional: CIDR blocks for API server access (max 200)
credentials:
type: Dynamic # uses 'astroctl cloud azure connect' credentials
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ selfHosted: Self-managed cluster on AWS or GCP ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
apiVersion: platform.astropulse.io/v1
kind: K8sCluster
spec:
clusterName: my-selfhosted-cluster
provider: aws # aws | gcp
region: us-east-1
clusterSpec:
controlPlane: # optional: customize control plane nodes
nodeGroup:
name: control-plane
machineTypes: [t3.medium]
minNode: 1 # must be odd (1, 3, 5)
maxNode: 1
dataPlane:
nodeGroups:
- name: ng-workers
minNode: 2
maxNode: 5
machineTypes: [t3.medium]
instanceType: OnDemand
provisioner:
type: selfHosted
selfHosted:
accountId: "123456789012" # AWS account ID or GCP project ID (required)
kubernetesVersion: "1.33.2" # optional: full semver only; astroctl cloud aws k8s-versions --self-hosted
credentials:
type: Vault # Vault is the only supported type for selfHosted
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Rules and constraints ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Required: clusterName, provider, region, provisioner.type, and the matching
provider spec (eks/gke/aks/selfHosted). clusterSpec.dataPlane.nodeGroups
requires at least one entry, except when the provider owns worker compute,
as EKS Auto Mode (provisioner.eks.computeMode: AutoMode) and GKE Autopilot
(provisioner.gke.autopilot: true) do; there it must be omitted.
Node group rules:
- minNode <= maxNode per group (equal is fine)
- minNode >= 1 on eks; 0 is allowed where the cluster scales the group back up (gke, aks user pools, selfHosted)
- AKS: first node group is the system pool; minNode >= 2
- selfHosted controlPlane: minNode/maxNode must be odd (1, 3, 5)
- selfHosted kubernetesVersion: full semver only (x.y.z, not x.y)
Credential types:
dynamic: AstroPulse uses the account connection; requires 'astroctl cloud aws|gcp|azure connect' first (EKS, GKE, AKS)
vault: AstroPulse reads them from its encrypted vault; requires 'astroctl cloud aws|gcp selfHosted connect' first (selfHosted only)
Discovery commands (use these to find valid values):
astroctl cloud aws k8s-versions -r us-west-2 # list supported Kubernetes versions
astroctl cloud aws machines list -r us-west-2 -m m6i.large # validate a machine type
astroctl cloud aws regions list # list supported regions
After apply, monitor progress:
astroctl infra k8s progress stream CLUSTER_NAME
astroctl infra kubernetes apply [flags]
Examples
# Apply cluster config from a file
astroctl infra k8s apply -f cluster.yaml
# Skip the confirmation prompt (CI/automation); the checklist still runs first
astroctl infra k8s apply -f cluster.yaml --yes
# Show the checklist without creating (dry-run)
astroctl infra k8s apply -f cluster.yaml --dry-run
# Pipe YAML from stdin (EKS example)
cat cluster-eks.yaml | astroctl infra k8s apply -f - --yes
# Pipe YAML inline
echo 'apiVersion: platform.astropulse.io/v1
kind: K8sCluster
spec:
clusterName: my-eks
provider: aws
region: us-east-1
clusterSpec:
dataPlane:
nodeGroups:
- name: workers
minNode: 2
maxNode: 2
machineTypes: [t3.medium]
instanceType: OnDemand
provisioner:
type: eks
eks:
accountId: "123456789012"
credentials:
type: Dynamic' | astroctl infra k8s apply -f - --yes
Options
--dry-run Show AstroPulse's checklist for the cluster and stop without creating it
--eks-compute-mode string Override EKS compute mode (ManagedNodeGroups|AutoMode)
-f, --file string The files that contain the configurations to apply. Use '-' to read from stdin.
-h, --help help for apply
--yes Skip the confirmation prompt; the checklist still runs and a failed check still stops
Options inherited from parent commands
-o, --output string Output format (table|json|yaml) (default "table")
SEE ALSO
- astroctl infra kubernetes - Manage Kubernetes clusters