Getting Started with kOps on Azure ¶
WARNING: Azure support on kOps is currently in alpha, which means that it is in the early stages of development and subject to change, please use with caution.
Features ¶
- Create, update and delete clusters
- Create, edit and delete instance groups
- Generate Terraform configuration with
--target=terraform(experimental, requiresAzureTerraformfeature flag) - Scale node instance groups with Cluster Autoscaler
- ...
Requirements ¶
- Latest kOps version installed
- kubectl installed
- Azure CLI installed
- Azure account with Contributor permissions for the cluster subscription and an existing storage account
- SSH key, both
id_ed25519andid_rsakeys are supported
Environment Variables ¶
Enable Azure ¶
Since Azure support is currently in alpha, it is feature gated and you will need to set:
export KOPS_FEATURE_FLAGS="Azure"
Azure-specific ¶
export AZURE_SUBSCRIPTION_ID=<subscription-id>
kOps-specific ¶
export KOPS_STATE_STORE=azureblob://<storage-account-name>/<container-name>
Creating a Single Master Cluster ¶
# Create a cluster in zone northeurope-1
kops create cluster --cloud azure --name my.k8s --zones northeurope-1 --azure-admin-user ubuntu --yes
# Validate the cluster
kops validate cluster --name my.k8s --wait=10m
# Export the kubeconfig file with the cluster admin user (make sure you keep this user safe!)
kops export kubeconfig --name my.k8s --admin
Updating a Cluster ¶
# Edit the cluster configuration
kops edit cluster --name my.k8s
# Edit the nodes instance group configuration
kops edit ig --name my.k8s nodes
# Preview the changes to be applied to the cluster
kops update cluster --name my.k8s
# Apply the changes to the cluster
kops update cluster --name my.k8s --yes
# Preview the node that need to be updated
kops rolling-update cluster --name my.k8s
# Replace the nodes that need to be updated
kops rolling-update cluster --name my.k8s --yes
Deleting a Cluster ¶
# Preview the resources to be deleted
kops delete cluster --name my.k8s
# Delete all the cluster resources
kops delete cluster --name my.k8s --yes
Ephemeral OS disks ¶
Setting rootVolumeType to one of the VM's local disks gives the instance group an Azure ephemeral OS disk: CacheDisk (host cache), ResourceDisk (temp disk) or NvmeDisk (local NVMe disk). OS disk writes go to that local disk; a StandardSSD_LRS managed base disk serves image reads and is billed. The VM size must have the local disk (SupportedEphemeralOSDiskPlacements in az vm list-skus) and the root volume must fit it: without rootVolumeSize, kOps uses 128 GiB for nodes and 64 GiB for the control plane.
spec:
machineType: Standard_D8ds_v5
rootVolumeType: ResourceDisk
rootVolumeSize: 300
The setting only applies when the VM Scale Set is created: changing rootVolumeType on an existing instance group makes kops update cluster fail and blocks rolling updates until it is reverted, so switch by creating a new instance group. The OS disk contents are lost when a VM is reimaged, resized, redeployed or healed, and stop/deallocate is not supported.
Cluster Autoscaler ¶
| Introduced |
|---|
| kOps 1.38 |
Cluster Autoscaler scales each node instance group between its minSize and maxSize:
spec:
clusterAutoscaler:
enabled: true
kops update cluster keeps the current number of nodes of an instance group while it is between minSize and maxSize. With --target=terraform, Terraform ignores changes to the number of nodes of an instance group whose minSize and maxSize differ.
When an instance group has no nodes, Cluster Autoscaler does not know its node labels and taints.
Managed Identities ¶
kOps assigns a system-assigned managed identity to each VM Scale Set. The control-plane identity is granted the following built-in roles:
- Contributor on the cluster resource group, used by cloud-controller-manager, the Azure Disk CSI driver, Cluster Autoscaler, etcd-manager and kops-controller.
- Storage Blob Data Contributor on the state-store storage account, used to read cluster configuration and write etcd backups.
Worker node identities are not granted any role.
TODO ¶
kOps for Azure currently does not support the following features:
- Azure AD Workload Identity
- Azure Disk volumes
- Azure Load Balancer
- Autoscaling using Karpenter
- Multi-master clusters
- ...
Next steps ¶
Now that you have a working kOps cluster, read through the recommendations for production setups guide to learn more about how to configure kOps for production workloads.
Migrating from earlier alpha versions ¶
Older alpha releases used azureblob://<container>/... URLs and read the storage account from AZURE_STORAGE_ACCOUNT. To upgrade an existing cluster:
unset AZURE_STORAGE_ACCOUNTand re-exportKOPS_STATE_STOREin the new shape.kops edit clusterto updatespec.configStore.baseto the updated URL.kops update cluster --yesandkops rolling-update cluster --yes.