Delivering modern cloud-native applications with open source technologies on Azure Kubernetes Service
In this section, we’ll be using the Azure Portal to create an Azure Kubernetes Service (AKS) cluster, configure kubectl
access to it, and deploy a sample application.
Adapted from the official Azure AKS documentation.
CLI version of these docs is also available from a previous lab.
Configure cluster details.
### Basics
kubecost-demo-cluster
.1.21.7
(default).### Networking
Here is what the configuration should look like.
kubectl
access to the clusterWe will be accessing the cluster using the Azure CLI az aks
command and kubectl
.
Open the terminal and login to Azure with the same credentials you used to create the AKS cluster.
$ az login
This will open your browser and take you to the sign in page to confirm your identity.
Sign in with your account credentials in the browser.
Configure kubectl
to connect to your Kubernetes cluster using the az aks get-credentials
command. The following command downloads credentials and configures the current kubectl
context to use them.
$ az aks get-credentials --resource-group myResourceGroup --name kubecost-demo-cluster
Verify the connection to your cluster using kubectl get to return a list of the cluster nodes.
$ kubectl get nodes
The output shows the single node created in the previous step.
NAME STATUS ROLES AGE VERSION
aks-agentpool-28582544-vmss000000 Ready agent 15m v1.21.7
aks-agentpool-28582544-vmss000002 Ready agent 15m v1.21.7
This step is optional. For the sake of this demo, we’ll deploy a small nginx server so that we can explore more cost data using Kubecost in the next section of this lab.
Create a namespace
$ kubectl create namespace nginx-app
Deploy the application
$ kubectl apply -f https://k8s.io/examples/application/deployment.yaml -n nginx-app
Verify the deployment
$ kubectl get deployments -n nginx-app
The output should look like this. Make sure the deployment is in READY
state.
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-deployment 2/2 2 2 10s