Created
February 12, 2024 09:17
-
-
Save knrt10/12fc7fc2dfb2af991a6072d5c62b2efa to your computer and use it in GitHub Desktop.
Create AKS cluster and get base64 encoded value of kubeconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
set -x | |
export RESOURCE_GROUP=headlamp-stateless | |
export LOCATION="EAST US" | |
export CLUSTER_NAME="headlamp" | |
export SSH_KEY=~/.ssh/headlamp.pub | |
# Create an AKS cluster | |
az aks create \ | |
--resource-group $RESOURCE_GROUP \ | |
--name $CLUSTER_NAME \ | |
--node-count 1 \ | |
--ssh-key-value $SSH_KEY | |
# Get the credentials for the AKS cluster | |
az aks get-credentials \ | |
--resource-group $RESOURCE_GROUP \ | |
--name $CLUSTER_NAME \ | |
--file kubeconfig | |
# Get the base64 value of kubeconfig | |
echo "$(base64 -i kubeconfig)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment