Azure Kubernetes Service (AKS) is a managed container orchestration service, based on the open source Kubernetes system, which is available on the Microsoft Azure public cloud. AKS allows you to quickly deploy a production ready Kubernetes cluster in Azure, deploy and manage containerized applications more easily with a fully managed Kubernetes service. We will see how to create AKS cluster in Azure cloud using Terraform.
AKS cluster can be created by many ways as mentioned below:
Creating an AKS resource with Terraform is incredibly easy, it only requires a single resource azurerm_kubernetes_cluster and in this post, we are going to walk through the necessary steps to create this with Terraform. We will create ACR and create a role with ACRpull assignment as well
Once the deployment is created, use kubectl to check on the deployments by running this command:
kubectl get deployments
To see the list of pods
kubectl get pods
Perform cleanup by deleting the AKS cluster
To avoid Azure charges, you should clean up unneeded resources. When the cluster is no longer needed, use terraform destroy command to remove the resource group, AKS cluster service, and all related resources.
Support for password authentication was removed on August 13, 2021
How to Fix for the above error:GitHub removed password authentication support from August 13, 2021 instead it recommends to use either OAuth or Personal Access Token.
Create Personal Access Token in GitHub
Go to GitHub.com--> Settings
Go to Developer Settings
Go to Personal Access tokens --> Generate new token
Enter name for the token, choose no expiration if you don't want your token to expire.
This is one of the common DevOps interview questions. What is the
difference between Ansible and Terraform? When will you choose Ansible over Terraform?
We will be learning how to execute Terraform scripts automatically using Jenkins pipeline. We will create EC2 instance using Terraform and Jenkins in AWS cloud.
Click on Build with Parameters and choose apply to build the infrastructure or choose destroy if you like to destroy the infrastructure you have built.
Click on Build
Now you should see the console output if you choose apply.
Pipeline will look like below:
Login to AWS console, you should see the new EC2 instance created.
We will see how to connect to GitHub from Jenkins using SSH keys instead of using user name and password. It is also a good practice to use SSH keys in Jenkins jobs instead of using user name and password.
Watch the steps in YouTube channel:
Pre-requistes:
Jenkins is up and running
Credentials plug-in installed in Jenkins
Create SSH keys in your Jenkins EC2 instance
ssh-keygen
enter four times. this will create keys in .ssh folder.
Copy and paste the public key
sudo cat ~/.ssh/id_rsa.pub
Add public Keys into your respective GitHub
Add public keys into your Repository--> settings--> Deploy keys section
Click on Add Deploy Key and enter public keys and save.
Add Private Keys in Jenkins Master
Login Jenkins. Go to Manage Jenkins. click on Credentials
Click on Jenkins
Click on Global Credentials
Click on Add Credentials
Choose SSH username with private key
Choose SSH username with private key username can be anything Click on enter directly under private key option and Click Add
Copy and paste private key(not public key) of your from Jenkins instance. command is below: sudo cat ~/.ssh/id_rsa
copy the content of whole output from above command.
Click OK to save.
Now go to any Jenkins Job, you can choose this option for checking out from GitHub. Make sure you enter SSH url not https url.
That's it. This is how you use SSH url and private keys to checkout code from bitbucket or Github without entering username/password in Jenkins.