Installing and maintaining Kubernetes clusters correctly and securely is difficult. Thankfully, all the major cloud providers, such as Azure, Amazon Web Services (AWS), and Google Cloud Platform (GCP), facilitate installing and maintaining clusters.
Different ways to create an AKS cluster
Using the portal: The portal offers a graphical user interface (GUI) for deploying your cluster through a wizard. This is a great way to deploy your first cluster. For multiple deployments or automated deployments, one of the following methods is recommended.
Using the Azure CLI: The Azure command-line interface (CLI) is a cross‑platform CLI for managing Azure resources. This allows you to script your cluster deployment, which can be integrated into other scripts.
Using Azure PowerShell: Azure PowerShell is a set of PowerShell commands used for managing Azure resources directly from PowerShell. It can also be used to create Kubernetes clusters.
Using ARM templates: Azure Resource Manager (ARM) templates are an Azure‑native way to deploy Azure resources using Infrastructure as Code (IaC). You can declaratively deploy your cluster, allowing you to create a template that can be reused by multiple teams.
Using Terraform for Azure: Terraform is an open‑source IaC tool developed by HashiCorp. The tool is very popular in the open‑source community for deploying cloud resources, including AKS. Like ARM templates, Terraform also uses declarative templates for your cluster.
Creating your first AKS cluster
We will start our initial cluster deployment using the Azure portal. The Azure portal is a web‑based management console. It allows you to build, manage, and monitor all your Azure deployments worldwide through a single console.
To start, browse to the Azure portal on https://portal.azure.com. Enter the keyword aks in the search bar at the top of the Azure portal. Click on Kubernetes services under the Services category in the search results:
This will take you to the AKS pane in the portal. As you might have expected, you don't have any clusters yet. Go ahead and create a new cluster by hitting the + Add button, and select the + Add Kubernetes cluster option:
In the Cluster configuration pane, you can instruct AKS to upgrade the control plane to a newer version. Typically, in a Kubernetes upgrade, you first upgrade the control plane, and then the individual node pools separately. This pane also allows you to enable role-based access control (RBAC) (which is enabled by default), and optionally integrate your cluster with Azure AD.
Finally, the Insights pane allows you to monitor your cluster infrastructure and the workloads running on your cluster. Since your cluster is brand new, there isn't a lot of data to investigate.
AKS nodes and node pools
Virtual nodes
Virtual node functionality depends on Azure Container Instances.
Now that you've created a new application gateway and were able to connect to it, we will move on to integrating this application gateway with your existing Kubernetes cluster.
Adding TLS to an ingress
- Ongoing monitoring to get alerts if something is not behaving as expected.
- Troubleshooting and debugging application errors.
Networking and network security in AKS
You'll first need to choose the networking model with which you'll deploy your cluster. This configuration has a limited impact on security, but it is important to understand from a networking perspective. There are two options:
Workload network security
However, you never restricted access to your application, except in the previous section, by deploying an internal load balancer. This means that the application was always publicly accessible. In the following example, you will create a service on your Kubernetes cluster that will have a public IP, but you will restrict access to it using an NSG that is configured by AKS.
By adding additional configuration to a Kubernetes service, you were able to limit who was able to connect to your service. You were able to confirm that only the public IP that was allowed to connect to the service was able to connect to it. A connection not coming from this public IP address timed out.