Git Product home page Git Product logo

aks-pod-identity's Introduction

AKS Pod Identity

AKS Pod Identity uses Kubernetes primitives to associate User Managed Identity with a pod, that allow containerized workload to authenticate with Azure Services

Overview

AKS Pod Identity Add-on enables containerized applications in AKS cluster to access services that uses Azure Active Directory (AAD) as an identity provider.

In AKS, following component is deployed to allow pods to use user managed identities:

  • The Node Management Identity (NMI) server is a pod that runs as a DaemonSet on each node in the AKS cluster. The NMI server listens for pod requests to Azure services.

In the following example, we create a pod that uses a user managed identity to request access token. Application can use that token to access any service integrated with Azure Active Directory:

AKS Pod Identity Flow

  1. Cluster operator first creates identity used by pods to request access to services.
  2. The NMI server relay any pod requests for access tokens to Azure AD.
  3. A developer deploys a pod with user managed identity that requests an access token through the NMI server.
  4. The token is returned to the pod and used to access Azure resources

For more details, refer AAD Pod Identity Microsoft documentation.

Prerequisites

You must have the following resource installed:

  • The Azure CLI, version 2.20.0 or later

    curl -L https://aka.ms/InstallAzureCli | bash
  • The aks-preview extension version 0.5.5 or later

    # Install the aks-preview extension
    az extension add --name aks-preview
    
    # Update the extension to make sure you have the latest version installed
    az extension update --name aks-preview
    OUPUT:
    $ az version
    {
      "azure-cli": "2.20.0",
      "azure-cli-core": "2.20.0",    
      "azure-cli-telemetry": "1.0.6",
      "extensions": {
        "aks-preview": "0.5.10",     
        "connectedk8s": "1.1.3"      
      }
    }

Register EnablePodIdentityPreview Feature

Pod Identity is a preview feature and has to be registered before use.

az feature register --name EnablePodIdentityPreview --namespace Microsoft.ContainerService

It takes a few minutes for the status to show Registered. You can check on the registration status using the az feature list command:

az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/EnablePodIdentityPreview')].{Name:name,State:properties.state}"

When ready, refresh the registration of the Microsoft.ContainerService resource provider using the az provider register command:

az provider register --namespace Microsoft.ContainerService

Create AKS cluster with Pod Identity Add-on

  • Set environment defaults.
SUBSCRIPTION_ID=<my-subsscription-id>
RESOURCE_GROUP=<my-aks-rg>
LOCATION=eastus2
CLUSTER_NAME=<my-aks-cluster>
  • Create an AKS cluster with CNI, managed identity and pod identity add-on enabled.
az group create \
  --name $RESOURCE_GROUP \
  --location $LOCATION
az aks create \
  --resource-group $RESOURCE_GROUP \
  --name $CLUSTER_NAME \
  --enable-managed-identity \
  --enable-pod-identity \
  --network-plugin azure
  • Verify whether pod identity add-on enabled.
az aks show \
  --resource-group $RESOURCE_GROUP \
  --name $CLUSTER_NAME \
  --query 'podIdentityProfile.enabled'

OUTPUT:
true
  • Generate kubeconfig to connect to the AKS cluster.
az aks get-credentials \
  --resource-group $RESOURCE_GROUP \
  --name $CLUSTER_NAME \
  --admin

Scenarios

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.