Note that the IP address is localhost, the port is 2022 (what was configured with the az network bastion tunnel command). In the configuration file for the SSH targets you can specify additional parameters. In VS Code you can now create a remote host, using the Remote SSH extension (make sure to install it if you hadn’t done that yet): target-resource-id $vm_id -resource-port 22 -port 2022 VS code also has an SSH client with its “Remote – SSH” extension, so how can we use it, and still leverage all the good things of VS Code? Easy, with Azure Bastion’s tunnel feature, we can “expose” the SSH port of our VM (which remember, has no public IP address) as a local port in our machine:Īz network bastion tunnel -n $bastion_name -g $rg \ Using Bastion with VS Codeīut we were talking about VS code, and all its good things. Spoiler alert: if you are wondering what is going on in the top tmux panel of the picture below, you will have to continue reading to the next section. Using your WSL ssh client with Azure Bastion In the picture below, you can see in the bottom panel how I connected to the test VM in the VNet where the private cluster is located: auth-type ssh-key -username yourusername -ssh-key ~/.ssh/id_rsa \Īnd sure enough, I can still use my own terminal with my tabs, the fonts I love (Mononoki if you are wondering), my TMUX panels, and the Death Star watching over my shoulder. Here the command I am using:Īz network bastion ssh -n $bastion_name -g $rg \ Using Bastion to access the jump host via SSHįirst question: can I use my existing native client in my Windows Subsystem for Linux to connect to a Linux VM in Azure that does not have a public IP address? The answer is yes! (note that this feature was previously restricted to Windows OS and it didn't work from WSL, you might need to upgrade your Azure CLI). ![]() So here I am, stealing his idea with pride and presenting it to you! In a recent event when we were going through an AKS hack exercise, my esteemed colleague Oliver Lintner used this setup to interact with his team's AKS private cluster, and I was blown away. However, whenever I need to access a private AKS cluster, I need to setup a jump VM in the same VNet as AKS, install all the tools, and go from there. ![]() And I like my Visual Studio Code environment even more, more specifically all my custom key shortcuts. ![]() Let's set things straight: it is not that I "hate" jump hosts, it is more that I "love" the way I have setup my PC's environment: I like my terminal: the colors, the fonts, the tabs, using tmux. Do you use AKS private clusters? Do you hate jump hosts? If the answer to both questions is "yes", this blog post might be interesting for you.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |