CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-containerservice

Microsoft Azure Container Service Management Client Library for Python

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

managed-clusters.mddocs/

Managed Cluster Operations

Core AKS cluster management operations including creation, updates, scaling, credential rotation, and deletion. The ManagedClustersOperations class provides comprehensive cluster lifecycle management with support for advanced networking, security, and monitoring configurations.

Capabilities

Cluster Retrieval

Get information about existing AKS clusters, including their configuration, status, and properties.

def get(
    resource_group_name: str,
    resource_name: str,
    **kwargs
) -> ManagedCluster:
    """
    Get the specified managed cluster.

    Parameters:
    - resource_group_name (str): The name of the resource group
    - resource_name (str): The name of the managed cluster
    
    Returns:
    ManagedCluster: The managed cluster resource
    
    Raises:
    ResourceNotFoundError: If the cluster doesn't exist
    """

Usage example:

from azure.mgmt.containerservice import ContainerServiceClient
from azure.identity import DefaultAzureCredential

client = ContainerServiceClient(DefaultAzureCredential(), "subscription-id")
cluster = client.managed_clusters.get("my-rg", "my-cluster")
print(f"Cluster location: {cluster.location}")
print(f"Kubernetes version: {cluster.kubernetes_version}")
print(f"Node count: {len(cluster.agent_pool_profiles)}")

Cluster Creation and Updates

Create new AKS clusters or update existing ones with comprehensive configuration options.

def begin_create_or_update(
    resource_group_name: str,
    resource_name: str,
    parameters: ManagedCluster,
    **kwargs
) -> LROPoller[ManagedCluster]:
    """
    Create or update a managed cluster.

    Parameters:
    - resource_group_name (str): The name of the resource group
    - resource_name (str): The name of the managed cluster
    - parameters (ManagedCluster): The cluster specification
    
    Returns:
    LROPoller[ManagedCluster]: Long-running operation poller
    """

Usage example:

from azure.mgmt.containerservice.models import (
    ManagedCluster, 
    ManagedClusterAgentPoolProfile,
    ContainerServiceLinuxProfile,
    ContainerServiceSshConfiguration,
    ContainerServiceSshPublicKey,
    ManagedClusterIdentity
)

# Create cluster configuration
cluster_config = ManagedCluster(
    location="East US",
    kubernetes_version="1.28.3",
    dns_prefix="my-cluster",
    agent_pool_profiles=[
        ManagedClusterAgentPoolProfile(
            name="system",
            count=3,
            vm_size="Standard_D2s_v3",
            os_type="Linux",
            mode="System"
        )
    ],
    linux_profile=ContainerServiceLinuxProfile(
        admin_username="azureuser",
        ssh=ContainerServiceSshConfiguration(
            public_keys=[
                ContainerServiceSshPublicKey(key_data="ssh-rsa AAAA...")
            ]
        )
    ),
    identity=ManagedClusterIdentity(type="SystemAssigned")
)

# Create cluster (async operation)
operation = client.managed_clusters.create_or_update("my-rg", "my-cluster", cluster_config)
cluster = operation.result()  # Wait for completion
print(f"Cluster created: {cluster.name}")

Cluster Listing

List managed clusters across resource groups or subscriptions.

def list(resource_group_name: str = None, **kwargs) -> ItemPaged[ManagedCluster]:
    """
    Get a list of managed clusters in the specified subscription.

    Parameters:
    - resource_group_name (str, optional): Scope to specific resource group
    
    Returns:
    ItemPaged[ManagedCluster]: Paginated list of clusters
    """

def list_by_resource_group(resource_group_name: str, **kwargs) -> ItemPaged[ManagedCluster]:
    """
    List managed clusters in the specified resource group.

    Parameters:
    - resource_group_name (str): The name of the resource group
    
    Returns:
    ItemPaged[ManagedCluster]: Paginated list of clusters
    """

Cluster Deletion

Delete AKS clusters with proper cleanup of associated resources.

def begin_delete(
    resource_group_name: str,
    resource_name: str,
    ignore_pod_disruption_budget: bool = None,
    **kwargs
) -> LROPoller[None]:
    """
    Delete a managed cluster.

    Parameters:
    - resource_group_name (str): The name of the resource group
    - resource_name (str): The name of the managed cluster
    - ignore_pod_disruption_budget (bool): Ignore PodDisruptionBudget during deletion
    
    Returns:
    LROPoller[None]: Long-running operation poller
    """

Credential Operations

Manage cluster credentials and access keys.

def list_cluster_admin_credentials(
    resource_group_name: str,
    resource_name: str,
    server_fqdn: str = None,
    **kwargs
) -> CredentialResults:
    """
    Get cluster admin credentials.

    Parameters:
    - resource_group_name (str): The name of the resource group
    - resource_name (str): The name of the managed cluster
    - server_fqdn (str): The server FQDN
    
    Returns:
    CredentialResults: Cluster admin credentials
    """

def list_cluster_user_credentials(
    resource_group_name: str,
    resource_name: str,
    server_fqdn: str = None,
    format: str = None,
    **kwargs
) -> CredentialResults:
    """
    Get cluster user credentials.

    Parameters:
    - resource_group_name (str): The name of the resource group
    - resource_name (str): The name of the managed cluster
    - server_fqdn (str): The server FQDN
    - format (str): Credential format (azure, exec)
    
    Returns:
    CredentialResults: Cluster user credentials
    """

Cluster Operations

Additional cluster management operations including start, stop, and reset.

def start(
    resource_group_name: str,
    resource_name: str,
    **kwargs
) -> LROPoller[None]:
    """
    Start a previously stopped managed cluster.

    Parameters:
    - resource_group_name (str): The name of the resource group  
    - resource_name (str): The name of the managed cluster
    
    Returns:
    LROPoller[None]: Long-running operation poller
    """

def stop(
    resource_group_name: str,
    resource_name: str,
    **kwargs
) -> LROPoller[None]:
    """
    Stop a running managed cluster.

    Parameters:
    - resource_group_name (str): The name of the resource group
    - resource_name (str): The name of the managed cluster
    
    Returns:
    LROPoller[None]: Long-running operation poller
    """

def rotate_cluster_certificates(
    resource_group_name: str,
    resource_name: str,
    **kwargs
) -> LROPoller[None]:
    """
    Rotate cluster certificates.

    Parameters:
    - resource_group_name (str): The name of the resource group
    - resource_name (str): The name of the managed cluster
    
    Returns:
    LROPoller[None]: Long-running operation poller
    """

Types

ManagedCluster

class ManagedCluster:
    """
    Managed cluster resource.
    
    Attributes:
    - location (str): Resource location
    - kubernetes_version (str): Kubernetes version
    - dns_prefix (str): DNS name prefix
    - fqdn (str): FQDN for the master pool
    - agent_pool_profiles (List[ManagedClusterAgentPoolProfile]): Agent pool profiles
    - linux_profile (ContainerServiceLinuxProfile): Linux VM configuration
    - windows_profile (ManagedClusterWindowsProfile): Windows VM configuration  
    - service_principal_profile (ManagedClusterServicePrincipalProfile): Service principal
    - addon_profiles (Dict[str, ManagedClusterAddonProfile]): Addon profiles
    - node_resource_group (str): Node resource group name
    - enable_rbac (bool): Enable Kubernetes RBAC
    - network_profile (ContainerServiceNetworkProfile): Network configuration
    - aad_profile (ManagedClusterAADProfile): AAD integration configuration
    - auto_upgrade_profile (ManagedClusterAutoUpgradeProfile): Auto-upgrade settings
    - identity (ManagedClusterIdentity): Cluster identity configuration
    - provisioning_state (str): Provisioning state
    - power_state (PowerState): Current power state
    - api_server_access_profile (ManagedClusterAPIServerAccessProfile): API server access
    """

Async Operations

All operations have async equivalents in the aio module:

from azure.mgmt.containerservice.aio import ContainerServiceClient

async with ContainerServiceClient(credential, subscription_id) as client:
    cluster = await client.managed_clusters.get("my-rg", "my-cluster")
    
    # Long-running operations return async pollers
    operation = await client.managed_clusters.begin_create_or_update("my-rg", "my-cluster", cluster_config)
    result = await operation.result()

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-containerservice

docs

agent-pools.md

index.md

machines.md

maintenance.md

managed-clusters.md

models.md

private-endpoints.md

snapshots.md

trusted-access.md

tile.json