This series of blog post will be help you to understand about the migration using Azure Kubernetes Service (AKS). This article is to cover the Azure Kubernetes Cluster creation and deploying a sample application using local repository.
First of all you need to create the resource Group and specially need to select the correct Location for that. You can run the below command to do that
$ az group create --name myResourceGroup --location eastus
To create the AKS Cluster, you can use the below command. Node count and the monitoring can be define there itself
$ az aks create --resource-group HemalAKS --name hemalAKSCluster --node-count 1 --enable-addons monitoring --generate-ssh-keys
Once this is executed, You will get the below output.
To configure
kubectl
to connect to your Kubernetes cluster, use the az aks get-credentials command. $ az aks get-credentials --resource-group HemalAKS --name HemalAKSCluster
To check whether you connected to the cluster you can run Kubectl get Namespace command.
If you have more than one cluster and want to check whether you are in the the collect place then you can run
$ Kubectl cluster-infor Command and see whether you are in the the correct cluster.
I’ using a sample code provided by Microsoft and the repo location is as below,
https://github.com/Azure-Samples/azure-voting-app-redis.git
Use git to clone the sample application to your development environment:
git clone https://github.com/Azure-Samples/azure-voting-app-redis.git
Then change the directory in to the cloned directory. For that you can run
$ cd azure-voting-app-redis
Inside this directory is the application source code, a pre-created Docker compose file, and a Kubernetes manifest file. going to use those files to run this.
To create the Container Image
Here i’m using Doker and hope you have already configured the Docker in your PC. Then run,
docker-compose up -d
Then the Docker image will be created locally and you can check the Docker Image status by running
$ docker images
$ docker ps will show you the running containers
To deploy this locally created Image into the Azure AKS cluster you can run
$ kubectl apply -f dockerise_image_name.yaml
This will deploy the Image into the created cluster and by running kubectl services or kubectl -n
Next post will see how to deploy this Image in the ACR and to the deployments.
No comments:
Post a Comment