Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this tutorial, part one of five, you learn how to:
- Install the Kubernetes CLI,
kubectl. - Create an Azure resource group.
- Create and deploy an Azure Linux Container Host for AKS cluster.
- Configure
kubectlto connect to your Azure Linux Container Host cluster.
In later tutorials, you learn how to add an Azure Linux node pool to an existing cluster and migrate existing nodes to Azure Linux.
Prerequisites
- You need the latest version of Azure CLI. Run
az --versionto find the version. If you need to install or upgrade, see Install Azure CLI.
Set environment variables
Set the following environment variables to create unique resource names for each deployment:
export RESOURCE_GROUP="<your-resource-group-name>"
export REGION="<your-region>"
export CLUSTER_NAME="<your-cluster-name>"
Create a resource group
When creating a resource group in Azure, you're required to specify a location. This location is the storage location of your resource group metadata and where your resources run in Azure if you don't specify another region when creating a resource.
Create a resource group using the az group create command.
az group create --name $RESOURCE_GROUP --location $REGION
Example output:
{
"id": "/subscriptions/xxxxx/resourceGroups/testAzureLinuxResourceGroupxxxxx",
"location": "EastUS2",
"managedBy": null,
"name": "testAzureLinuxResourceGroupxxxxx",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
Create an Azure Linux Container Host for AKS cluster
Create an AKS cluster using the az aks create command with the --os-sku parameter to provision the Azure Linux Container Host with an Azure Linux image.
az aks create --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --os-sku AzureLinux
Example output:
{
"id": "/subscriptions/xxxxx/resourceGroups/testAzureLinuxResourceGroupxxxxx/providers/Microsoft.ContainerService/managedClusters/testAzureLinuxClusterxxxxx",
"location": "WestUS2",
"name": "testAzureLinuxClusterxxxxx",
"properties": {
"provisioningState": "Succeeded"
},
"type": "Microsoft.ContainerService/managedClusters"
}
After a few minutes, the command completes and returns JSON-formatted information about the cluster.
Connect to the cluster using kubectl
Configure kubectl to connect to your Kubernetes cluster using the az aks get-credentials command.
az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME
Verify the connection to your cluster
Verify the connection to your cluster using the kubectl get nodes command. The command returns a list of nodes in your cluster.
kubectl get nodes
Example output:
NAME STATUS ROLES AGE VERSION
aks-nodepool1-00000000-0 Ready agent 10m v1.20.7
aks-nodepool1-00000000-1 Ready agent 10m v1.20.7
Next step
In this tutorial, you created and deployed an Azure Linux Container Host cluster. In the next tutorial, you learn how to add an Azure Linux node pool to an existing cluster.