Skip to content

Instantly share code, notes, and snippets.

@knrt10
Created February 12, 2024 09:17
Show Gist options
  • Save knrt10/12fc7fc2dfb2af991a6072d5c62b2efa to your computer and use it in GitHub Desktop.
Save knrt10/12fc7fc2dfb2af991a6072d5c62b2efa to your computer and use it in GitHub Desktop.
Create AKS cluster and get base64 encoded value of kubeconfig
#!/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