Posted on Leave a comment

Deploy kubernetes cluster with kubectl and azure devops

In this guide we will examine how you can deploy pods on your Azure Kubernetes Cluster with Azure devops. In order to getting started you will need to create an AKS cluster under a resource group and connect this cluster with azure devops. After the creation you will need to connect with the cluster and export the kubeconfig file for the ado service connection.

You can do that by pressing connect

You can read the rest of the article on Medium using the link below:

A detailed deployment video can be found on my Udemy course:
https://www.udemy.com/course/mastering-azure-devops-cicd-pipelines-with-yaml/

Posted on Leave a comment

kubectl commands cheat sheet for daily kubernetes administration

This is a cheat sheet for basic k8s commands that one k8s administrator can use daily.

Apply a YAML definition on k8s-cluster:

kubectl apply -f pod.yaml

Apply a definition on specific namespace:

Kubectl apply -f kati.yml -n namespacename

Create a new namespace:

kubectl create ns namespacename

Set k8s cluster context:

kubectl config use-context geralexgr-aks

Get k8s cluster context:

kubectl config view

Create a deployment:

kubectl create deployment new-app --image=hello-world:latest

Delete a deployment:

kubectl delete deployment nginx -n nginx

Describe a service:

Kubectl describe service/myservice

Get logs for pod:

Kubectl logs pod-123

Get cluster namespaces:

kubectl get namespace

Set active namespace:

kubectl config set-context --current --namespace nginx

Delete a pod:

kubectl delete pod nginx-pod

Scale a deployment:

kubectl scale --replicas=5 deployment/deploymentname

Get pods with labels:

kubectl get pods --show-labels

Get cluster scoped resources:

kubectl api-resources