{"id":5174,"date":"2026-11-18T21:21:14","date_gmt":"2026-11-18T21:21:14","guid":{"rendered":"https:\/\/bitflow-solutions.com\/guias-tecnicas\/kubernetes-administration-aks-gke-eks\/"},"modified":"2026-11-18T21:21:14","modified_gmt":"2026-11-18T21:21:14","slug":"kubernetes-administration-aks-gke-eks","status":"publish","type":"bf_guia","link":"https:\/\/bitflow-solutions.com\/en\/guias-tecnicas\/kubernetes-administration-aks-gke-eks\/","title":{"rendered":"Kubernetes administration on AKS, GKE and EKS: a practical guide"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A practical guide to <strong>Kubernetes administration<\/strong> on the three most common managed services: <strong>AKS<\/strong> (Azure), <strong>GKE<\/strong> (Google Cloud) and <strong>EKS<\/strong> (AWS). The <code>kubectl<\/code> commands are the same on all three; what changes is how you connect, scale the nodes and upgrade the cluster, and here you have them side by side. All the commands are also in the <strong>README.md<\/strong> on the left.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What you\u2019ll learn<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Connecting to an AKS, GKE or EKS cluster from Windows and switching between clusters without mistakes.<\/li>\n\n\n<li>Checking the status of nodes, pods and services, and diagnosing a failing pod.<\/li>\n\n\n<li>Deploying, scaling and rolling back a deployment with <code>kubectl<\/code>.<\/li>\n\n\n<li>Scaling nodes, carrying out maintenance on a node and upgrading the Kubernetes version on each cloud.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An <strong>AKS<\/strong>, <strong>GKE<\/strong> or <strong>EKS<\/strong> cluster, and permissions to administer it on that cloud.<\/li>\n\n\n<li><strong>Windows<\/strong> with <strong>PowerShell<\/strong> and <code>winget<\/code> (the <code>kubectl<\/code> commands are the same on macOS and Linux).<\/li>\n\n\n<li>For EKS, <strong>eksctl<\/strong> (see its official installation guide).<\/li>\n\n\n<li>Knowledge of the basic Kubernetes objects: pod, deployment, service and namespace.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step by step<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Install the tools<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>kubectl<\/code> is the common tool; each cloud adds its own CLI to create credentials and manage the infrastructure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># kubectl (common to all three clouds)\nwinget install -e --id Kubernetes.kubectl\n\n# Your cloud's CLI\nwinget install -e --id Microsoft.AzureCLI      # Azure (AKS)\nwinget install -e --id Google.CloudSDK         # Google Cloud (GKE)\nwinget install -e --id Amazon.AWSCLI           # AWS (EKS)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Close and reopen PowerShell, and check with <code>kubectl version --client<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Connect to the cluster<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Each CLI downloads the cluster\u2019s credentials and adds them to your <code>~\/.kube\/config<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># AKS\naz login\naz aks get-credentials --resource-group rg-production --name aks-production\n\n# GKE (needs the authentication plugin)\ngcloud auth login\ngcloud components install gke-gcloud-auth-plugin\ngcloud container clusters get-credentials gke-production --region europe-southwest1 --project my-project\n\n# EKS\naws configure\naws eks update-kubeconfig --region eu-south-2 --name eks-production<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Switch between clusters without mistakes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Each cluster is a <strong>context<\/strong>. Before making any change, check which one you are in: a command in the wrong context can affect production.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl config get-contexts           # all configured clusters\nkubectl config current-context        # which one you are in\nkubectl config use-context aks-production\nkubectl config set-context --current --namespace=orders   # default namespace<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Check the cluster\u2019s status<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get nodes -o wide             # nodes, version, IP and status\nkubectl get pods -A                   # all pods in all namespaces\nkubectl get pods -n orders -o wide    # pods in a namespace and which node they are on\nkubectl get deploy,svc,ingress -n orders\nkubectl top nodes                     # CPU and memory usage (needs metrics-server)\nkubectl top pods -n orders<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Diagnose a failing pod<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The usual order: <code>describe<\/code> to see the events and the reason, <code>logs<\/code> (with <code>--previous<\/code> if it restarted) to see the application error and, if needed, open a shell in the container:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl describe pod tasks-api-7c9d8 -n orders     # status, events and reason for failure\nkubectl logs tasks-api-7c9d8 -n orders             # container logs\nkubectl logs -f deploy\/tasks-api -n orders         # follow the logs live\nkubectl logs tasks-api-7c9d8 -n orders --previous  # logs of the previous container (after a restart)\nkubectl get events -n orders --sort-by=.lastTimestamp\nkubectl exec -it tasks-api-7c9d8 -n orders -- sh   # open a shell in the container\nkubectl port-forward svc\/tasks-api 8080:80 -n orders   # test an internal service at localhost:8080<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Deploy, scale and roll back changes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A basic Deployment, with resources and health checks, which is what gives the most stability:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: tasks-api\n  namespace: orders\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: tasks-api\n  template:\n    metadata:\n      labels:\n        app: tasks-api\n    spec:\n      containers:\n        - name: api\n          image: ghcr.io\/company\/tasks-api:1.4.0\n          ports:\n            - containerPort: 80\n          resources:\n            requests:\n              cpu: 100m\n              memory: 128Mi\n            limits:\n              memory: 256Mi\n          readinessProbe:\n            httpGet:\n              path: \/\n              port: 80\n          livenessProbe:\n            httpGet:\n              path: \/\n              port: 80<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And the everyday commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl apply -f deployment.yaml                         # create or update from a file\nkubectl set image deployment\/tasks-api api=ghcr.io\/company\/tasks-api:1.4.0 -n orders\nkubectl rollout status deployment\/tasks-api -n orders    # wait for it to finish\nkubectl rollout history deployment\/tasks-api -n orders\nkubectl rollout undo deployment\/tasks-api -n orders      # go back to the previous version\nkubectl rollout restart deployment\/tasks-api -n orders   # restart all pods in an orderly way\nkubectl scale deployment\/tasks-api --replicas=4 -n orders<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Scale the nodes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">More pod replicas need more nodes. Each cloud scales its node groups with its own CLI (or with the cluster autoscaler, if you enable it):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># AKS\naz aks nodepool scale --resource-group rg-production --cluster-name aks-production --name nodepool1 --node-count 4\n\n# GKE\ngcloud container clusters resize gke-production --node-pool default-pool --num-nodes 4 --region europe-southwest1\n\n# EKS (with eksctl)\neksctl scale nodegroup --cluster eks-production --name ng-general --nodes 4<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">8. Carry out maintenance on a node<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before restarting or replacing a node, drain it: <code>cordon<\/code> stops it from receiving new pods and <code>drain<\/code> moves the ones it has to other nodes while respecting the PodDisruptionBudgets:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl cordon aks-nodepool1-12345678-vmss000002   # do not schedule new pods on the node\nkubectl drain aks-nodepool1-12345678-vmss000002 --ignore-daemonsets --delete-emptydir-data\n# ... node maintenance ...\nkubectl uncordon aks-nodepool1-12345678-vmss000002 # receives pods again<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">9. Upgrade the Kubernetes version<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">All three clouds upgrade the control plane first and then the nodes, one minor version at a time. Check the release notes beforehand in case an API you use is being removed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># AKS: available versions and upgrade\naz aks get-upgrades --resource-group rg-production --name aks-production --output table\naz aks upgrade --resource-group rg-production --name aks-production --kubernetes-version 1.31.2\n\n# GKE: first the control plane, then the node pools\ngcloud container clusters upgrade gke-production --master --cluster-version 1.31 --region europe-southwest1\ngcloud container clusters upgrade gke-production --node-pool default-pool --region europe-southwest1\n\n# EKS: control plane and then the node groups\neksctl upgrade cluster --name eks-production --approve\neksctl upgrade nodegroup --cluster eks-production --name ng-general<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">10. Keep the equivalences between clouds to hand<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Task<\/th><th>AKS (Azure)<\/th><th>GKE (Google Cloud)<\/th><th>EKS (AWS)<\/th><\/tr><\/thead><tbody><tr><td>Connect<\/td><td><code>az aks get-credentials<\/code><\/td><td><code>gcloud container clusters get-credentials<\/code><\/td><td><code>aws eks update-kubeconfig<\/code><\/td><\/tr><tr><td>Scale nodes<\/td><td><code>az aks nodepool scale<\/code><\/td><td><code>gcloud container clusters resize<\/code><\/td><td><code>eksctl scale nodegroup<\/code><\/td><\/tr><tr><td>Upgrade version<\/td><td><code>az aks upgrade<\/code><\/td><td><code>gcloud container clusters upgrade<\/code><\/td><td><code>eksctl upgrade cluster<\/code><\/td><\/tr><tr><td>Image registry<\/td><td>Azure Container Registry<\/td><td>Artifact Registry<\/td><td>Amazon ECR<\/td><\/tr><tr><td>User authentication<\/td><td>Microsoft Entra ID<\/td><td>Google Cloud IAM<\/td><td>IAM and access entries<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">CrashLoopBackOff<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The container starts and crashes over and over again. Look at <code>kubectl logs &lt;pod&gt; --previous<\/code>: it is usually an application error, a missing environment variable or secret, or a connection that cannot be established.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">ImagePullBackOff or ErrImagePull<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It cannot download the image: the name or tag is misspelt, or the cluster does not have permission for the registry. On AKS, <code>az aks update --resource-group rg --name aks --attach-acr my-registry<\/code>; on the others, an <code>imagePullSecrets<\/code> or the node\u2019s IAM permissions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Pod in Pending<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No node can host it. <code>kubectl describe pod<\/code> tells you why: not enough CPU or memory, a <code>nodeSelector<\/code> or toleration that does not match, or a volume that cannot be mounted. Scale the nodes or adjust the <code>requests<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">OOMKilled<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The container exceeded its memory limit and Kubernetes killed it. Increase <code>limits.memory<\/code> or review the application\u2019s usage with <code>kubectl top pods<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u201cYou must be logged in to the server (Unauthorized)\u201d<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The credentials have expired or your user does not have access. Run the credentials command from step 2 again; on EKS, your IAM user or role must have an <em>access entry<\/em> in the cluster.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u201cgke-gcloud-auth-plugin not found\u201d<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Since version 1.26, kubectl needs Google\u2019s authentication plugin. Install it with <code>gcloud components install gke-gcloud-auth-plugin<\/code> and request the credentials again.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u201cdrain\u201d keeps waiting<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A PodDisruptionBudget does not allow more pods of that application to be evicted. Check with <code>kubectl get pdb -A<\/code> and increase the replicas before draining the node.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next steps<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Automate deployments with a pipeline (see the CI\/CD with GitHub Actions guide).<\/li>\n\n\n<li>Enable autoscaling for pods (Horizontal Pod Autoscaler) and nodes (cluster autoscaler).<\/li>\n\n\n<li>Describe the infrastructure with Terraform to create and update clusters reproducibly.<\/li>\n\n\n<li>Centralise logs and metrics (for example, Prometheus and Grafana) and define alerts.<\/li>\n\n\n<li>Manage deployments with GitOps (Argo CD or Flux).<\/li>\n\n<\/ul>\n\n\n","protected":false},"excerpt":{"rendered":"<p>The everyday administration commands for Azure Kubernetes Service, Google Kubernetes Engine and Amazon EKS: connection, status, diagnosis, deployments, scaling, maintenance and upgrades.<\/p>\n","protected":false},"featured_media":0,"template":"","bf_tecnologia":[103,104,106],"bf_nivel":[109],"class_list":["post-5174","bf_guia","type-bf_guia","status-publish","hentry","bf_tecnologia-cloud-en","bf_tecnologia-devops-en","bf_tecnologia-monitoring","bf_nivel-intermediate"],"acf":[],"_links":{"self":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia\/5174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia"}],"about":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/types\/bf_guia"}],"version-history":[{"count":0,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_guia\/5174\/revisions"}],"wp:attachment":[{"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/media?parent=5174"}],"wp:term":[{"taxonomy":"bf_tecnologia","embeddable":true,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_tecnologia?post=5174"},{"taxonomy":"bf_nivel","embeddable":true,"href":"https:\/\/bitflow-solutions.com\/en\/wp-json\/wp\/v2\/bf_nivel?post=5174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}