{"id":15661226,"url":"https://github.com/trstringer/az-aks-ssh","last_synced_at":"2025-05-05T21:41:59.573Z","repository":{"id":38238489,"uuid":"359234363","full_name":"trstringer/az-aks-ssh","owner":"trstringer","description":"SSH into Azure Kubernetes Service (AKS) nodes","archived":false,"fork":false,"pushed_at":"2023-01-13T14:20:32.000Z","size":55,"stargazers_count":22,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-04T13:26:25.935Z","etag":null,"topics":["aks-cluster","azure","azure-kubernetes-service","kubernetes","ssh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trstringer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-18T19:26:29.000Z","updated_at":"2024-07-14T11:57:07.000Z","dependencies_parsed_at":"2023-02-09T16:00:52.223Z","dependency_job_id":null,"html_url":"https://github.com/trstringer/az-aks-ssh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trstringer%2Faz-aks-ssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trstringer%2Faz-aks-ssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trstringer%2Faz-aks-ssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trstringer%2Faz-aks-ssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trstringer","download_url":"https://codeload.github.com/trstringer/az-aks-ssh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221145907,"owners_count":16763931,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aks-cluster","azure","azure-kubernetes-service","kubernetes","ssh"],"created_at":"2024-10-03T13:26:33.555Z","updated_at":"2024-10-23T01:43:37.546Z","avatar_url":"https://github.com/trstringer.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSH into AKS agent nodes\n\nThere is documentation on [how to SSH into AKS nodes (Microsoft docs)](https://docs.microsoft.com/en-us/azure/aks/ssh). That process is long and quite manual. This script automates this.\n\n*Note: this script is currently in alpha and should not be used in a production environment.*\n\n## Setup and dependencies\n\nClone this git repo and use the `az-aks-ssh.sh` direction (see below for usage).\n\nDependencies:\n\n* kubectl\n* Azure CLI\n\n## Usage\n\n```\nUsage:\n  SSH into an AKS agent node (pass in -c to run a single command\n  or omit for an interactive session):\n    ./az-aks-ssh.sh \\\n        -g|--resource-group \u003cresource_group\u003e \\\n        -n|--cluster-name \u003ccluster\u003e \\\n        -d|--node-name \u003cnode_name|any\u003e \\\n        [-c|--command \u003ccommand\u003e] \\\n        [-o|--output-file \u003cfile\u003e]\n\n  Delete all locally generated SSH keys (~/.ssh/az_aks_*):\n    ./az-aks-ssh.sh --clear-local-ssh-keys\n\n  Delete the SSH proxy pod:\n    ./az-aks-ssh.sh --delete-ssh-pod\n\n  Cleanup SSH (delete SSH proxy pod and remove all keys):\n    ./az-aks-ssh.sh --cleanup\n```\n\n## Examples\n\n**SSH into any agent node in an interactive SSH session**\n\n```\n$ ./az-aks-ssh.sh -g rg1 -n aks1 -d any\n```\n\n**SSH into a specific agent node (get node name from `kubectl get no`)**\n\n```\n$ ./az-aks-ssh.sh -g rg1 -n aks1 -d cluster_node\n```\n\n**Run a single command non-interactively**\n\n```\n$ ./az-aks-ssh.sh -g rg1 -n aks1 -d any -c \"ps -aux\"\n```\n\n**Run a command non-interactively and save the output to a file**\n\n```\n$ ./az-aks-ssh.sh -g rg1 -n aks1 -d any -c \"ps -aux\" -o ~/aks-ssh.out\n```\n\n**Cleanup the environment (delete agent node SSH keys locally and remove the SSH proxy pod)**\n\n```\n$ ./az-aks-ssh.sh --cleanup\n```\n\n## More information\n\n**Design**\n\n![Design](./design.png)\n\n**SSH keys**\n\nThe SSH keys are generated for individual nodes. This ensures that keys are not being reused for multiple hosts. `--cleanup` removes all keys that match the prefix: `~/.ssh/az_aks*`.\n\n**SSH proxy pod**\n\nThis design uses a proxy pod that sleeps forever so that it can be reused. `--cleanup` deletes this pod from the Kubernetes cluster. To see this pod you can run `kubectl get po aks-ssh-session`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrstringer%2Faz-aks-ssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrstringer%2Faz-aks-ssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrstringer%2Faz-aks-ssh/lists"}