Using Homebrew to set up your environment (kubectl, Azure CLI) - HOSSTED

Using Homebrew to set up your environment (kubectl, Azure CLI)

This  tutorial describes how to use Homebrew to install Azure CLI and kubectl on macOS.

The tutorial contains 3 sections:

  1. Installing Homebrew

  2. Installing kubectl

  3. Installing Azure CLI

1. Installing Homebrew
Paste the following in a macOS Terminal or Linux shell prompt:
 

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

 

 
2. Installing kubectl 

To install kubectl with Homebrew on MacOS:

2.1 Run the following installation command:

 

brew install kubectl

or

brew install kubernetes-cli

2.2  Test to ensure the version you installed is up-to-date:

 

kubectl version --client

 

3. Installing the Azure CLI

3.1 You can install the CLI by updating your brew repository information, and then running the install command:

 

brew update && brew install azure-cli

 

 

3.2 You can then run the Azure CLI with the az command. To sign in, use az login command.

 

3.3 Run the login command.

 

az login

 

3.4 If the CLI can open your default browser, it will do so and load an Azure sign-in page.

 

Otherwise, open a browser page at https://aka.ms/devicelogin and enter the authorization code displayed in your terminal.

 

 

3.5 After you’ve installed all the items, you need to set subscription and get credentials for the resource group.

 

Run the following commands:

 

az account set --subscription "Main Subscription"

 

az aks get-credentials --resource-group aks-dev --name aks-dev

 

 

Useful links:
https://kubernetes.io/docs/tasks/tools/install-kubectl
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-macos?view=azure-cli-latest
https://brew.sh/

Skip to content