Not able to Connect with SSH to Azure Kubernetes Service (AKS) node

Shadi Haidar 1 Reputation point
2020-06-23T19:40:03.23+00:00

I created an AKS with 1 nodepool/node. The AKS was created successfully:

sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet> kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
aks-ssh 1/1 Running 0 71m 10.244.0.28 aks-agentpool-21324540-vmss000000 <none> <none>
sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet>

Now I'm trying to ssh to the AKS node following steps from: https://learn.microsoft.com/en-us/azure/aks/ssh

All the steps worked ok up until following steps:

kubectl run --generator=run-pod/v1 -it --rm aks-ssh --image=debian

When I ran it, received following error:

sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet> kubectl run --generator=run-pod/v1 -it aks-ssht --image=debian
Flag --generator has been deprecated, has no effect and will be removed in the future.
If you don't see a command prompt, try pressing enter.
Error attaching, falling back to logs: Upgrade request required
sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet>

This issue happens when I try this command from my local VM which is running following versions:

sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet> kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.4", GitCommit:"c96aede7b5205121079932896c4ad89bb93260af", GitTreeState:"clean", BuildDate:"2020-06-17T11:41:22Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.11", GitCommit:"ec831747a3a5896dbdf53f259eafea2a2595217c", GitTreeState:"clean", BuildDate:"2020-05-29T19:56:10Z", GoVersion:"go1.12.17", Compiler:"gc", Platform:"linux/amd64"}
sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet>

Client:
Version: 18.09.7
API version: 1.39
Go version: go1.10.4
Git commit: 2d0083d
Built: Fri Aug 16 14:19:38 2019
OS/Arch: linux/amd64
Experimental: false

Server:
Engine:
Version: 18.09.7
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 2d0083d
Built: Thu Aug 15 15:12:41 2019
OS/Arch: linux/amd64
Experimental: false
sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet>

Thank you.
Shadi Haidar
shadi.h1@Karima ben .com

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,886 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Shadi Haidar 1 Reputation point
    2020-06-24T16:43:30.063+00:00

    Still getting the same issue:

    sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet> az aks get-credentials -n k8stest -g k8sRG
    Connection verification disabled by environment variable AZURE_CLI_DISABLE_CONNECTION_VERIFICATION
    /opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
    InsecureRequestWarning)
    /opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
    InsecureRequestWarning)
    /home/sh1986/.kube/config has permissions "770".
    It should be readable and writable only by its owner.
    Merged "k8stest" as current context in /home/sh1986/.kube/config
    sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet>

    sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet> kubectl run -it --rm aks-ssh2 --image=debian
    If you don't see a command prompt, try pressing enter.
    Error attaching, falling back to logs: Upgrade request required
    pod "aks-ssh2" deleted
    sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet>

    0 comments No comments

  2. Shadi Haidar 1 Reputation point
    2020-06-25T14:16:59.663+00:00

    I'm running az cli version later than 2.0.64:

    sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet> az --version
    azure-cli 2.7.0

    command-modules-nspkg 2.0.3
    core 2.7.0
    nspkg 3.0.4
    telemetry 1.0.4

    Python location '/opt/az/bin/python3'
    Extensions directory '/home/sh1986/.azure/cliextensions'

    Python (Linux) 3.6.10 (default, May 29 2020, 08:10:14)
    [GCC 5.4.0 20160609]

    Legal docs and information: aka.ms/AzureCliLegal

    Unable to check if your CLI is up-to-date. Check your internet connection.

    Please let us know how we are doing: https://aka.ms/clihats
    and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
    sh1986-vb:/media/sf_SH1986/az/tf/terraform-aks-k8s-w-vnet>