Skip to content

az aks exception #31345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
edknauer opened this issue Apr 24, 2025 · 12 comments
Closed

az aks exception #31345

edknauer opened this issue Apr 24, 2025 · 12 comments
Labels
AKS az aks/acs/openshift Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@edknauer
Copy link

edknauer commented Apr 24, 2025

Describe the bug

On Ubuntu 24.04 all aks commands throw an exception. Below an example:

$ az aks get-credentials  -g XXXXXXX -n YYYYYYY

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute '__dict__'
.....

A downgrade from aks-preview to version 14.0.0b3 fixes the problem, so it is probably a bug in aks-preview version 14.0.0b4

Related command

az aks get-credentials -g XXXXXXX -n YYYYYYY

Errors

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'dict'
Traceback (most recent call last):
File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 564, in execute
self.commands_loader.load_arguments(command)
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 549, in load_arguments
loader.load_arguments(command) # this adds entries to the argument registries
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/init.py", line 45, in load_arguments
load_arguments(self, command)
File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/_params.py", line 429, in load_arguments
k8s_support_plans = self.get_models(
^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/init.py", line 804, in get_models
return get_sdk(self.cli_ctx, resource_type, *attr_args, mod='models', operation_group=operation_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/init.py", line 91, in get_sdk
return _sdk_get_versioned_sdk(cli_ctx.cloud.profile, resource_type, *attr_args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 692, in get_versioned_sdk
sdk_path = get_versioned_sdk_path(api_profile, resource_type, operation_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 684, in get_versioned_sdk_path
api_version = getattr(api_version, operation_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 479, in getattr
self._resolve()
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 466, in _resolve
for operation_group_name, operation_type in self._client_type.dict.items():
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'dict'. Did you mean: 'dir'?
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

$ az aks get-credentials  -g ek-aks-test -n ek-aks-test-cluster-01 --debug
cli.knack.cli: Command arguments: ['aks', 'get-credentials', '-g', 'XXXXXXX', '-n', 'YYYYYYYY', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7d154c5937e0>, <function OutputProducer.on_global_arguments at 0x7d154c2f67a0>, <function CLIQuery.on_global_arguments at 0x7d154c33bce0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'aks': ['azext_aks_preview', 'azure.cli.command_modules.acs', 'azure.cli.command_modules.serviceconnector']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: acs                       0.036        15        79
cli.azure.cli.core: serviceconnector          0.030        20       323
cli.azure.cli.core: Total (2)                 0.066        35       402
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.knack.cli: Event: CommandLoader.OnLoadCommandTable []
cli.azure.cli.core: aks-preview               0.004        22       103  /home/knauer/.azure/cliextensions/aks-preview
cli.azure.cli.core: Total (1)                 0.004        22       103  
cli.azure.cli.core: Loaded 43 groups, 437 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : aks get-credentials
cli.azure.cli.core: Command table: aks get-credentials
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7d154b4a4220>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/knauer/.azure/commands/2025-04-24.16-07-00.aks_get-credentials.445562.log'.
az_command_data_logger: command args: aks get-credentials -g {} -n {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7d154b504720>]
cli.knack.cli: Event: CommandLoader.OnLoadArguments []
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 653, in _get_attr
    op = import_module(full_mod_path)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/vendored_sdks/azure_mgmt_preview_aks/__init__.py", line 9, in <module>
    from ._container_service_client import ContainerServiceClient
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/vendored_sdks/azure_mgmt_preview_aks/_container_service_client.py", line 19, in <module>
    from azure.mgmt.core.tools import get_arm_endpoints
ImportError: cannot import name 'get_arm_endpoints' from 'azure.mgmt.core.tools' (/opt/az/lib/python3.12/site-packages/azure/mgmt/core/tools.py)

cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 549, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/__init__.py", line 45, in load_arguments
    load_arguments(self, command)
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/_params.py", line 429, in load_arguments
    k8s_support_plans = self.get_models(
                        ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 804, in get_models
    return get_sdk(self.cli_ctx, resource_type, *attr_args, mod='models', operation_group=operation_group)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/__init__.py", line 91, in get_sdk
    return _sdk_get_versioned_sdk(cli_ctx.cloud.profile, resource_type, *attr_args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 692, in get_versioned_sdk
    sdk_path = get_versioned_sdk_path(api_profile, resource_type, operation_group)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 684, in get_versioned_sdk_path
    api_version = getattr(api_version, operation_group)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 479, in __getattr__
    self._resolve()
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 466, in _resolve
    for operation_group_name, operation_type in self._client_type.__dict__.items():
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '__dict__'. Did you mean: '__dir__'?

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: 'NoneType' object has no attribute '__dict__'
Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 549, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/__init__.py", line 45, in load_arguments
    load_arguments(self, command)
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/_params.py", line 429, in load_arguments
    k8s_support_plans = self.get_models(
                        ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 804, in get_models
    return get_sdk(self.cli_ctx, resource_type, *attr_args, mod='models', operation_group=operation_group)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/__init__.py", line 91, in get_sdk
    return _sdk_get_versioned_sdk(cli_ctx.cloud.profile, resource_type, *attr_args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 692, in get_versioned_sdk
    sdk_path = get_versioned_sdk_path(api_profile, resource_type, operation_group)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 684, in get_versioned_sdk_path
    api_version = getattr(api_version, operation_group)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 479, in __getattr__
    self._resolve()
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 466, in _resolve
    for operation_group_name, operation_type in self._client_type.__dict__.items():
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '__dict__'. Did you mean: '__dir__'?
az_command_data_logger: 'NoneType' object has no attribute '__dict__'
Traceback (most recent call last):
  File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 549, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/__init__.py", line 45, in load_arguments
    load_arguments(self, command)
  File "/home/knauer/.azure/cliextensions/aks-preview/azext_aks_preview/_params.py", line 429, in load_arguments
    k8s_support_plans = self.get_models(
                        ^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 804, in get_models
    return get_sdk(self.cli_ctx, resource_type, *attr_args, mod='models', operation_group=operation_group)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/__init__.py", line 91, in get_sdk
    return _sdk_get_versioned_sdk(cli_ctx.cloud.profile, resource_type, *attr_args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 692, in get_versioned_sdk
    sdk_path = get_versioned_sdk_path(api_profile, resource_type, operation_group)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 684, in get_versioned_sdk_path
    api_version = getattr(api_version, operation_group)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 479, in __getattr__
    self._resolve()
  File "/opt/az/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 466, in _resolve
    for operation_group_name, operation_type in self._client_type.__dict__.items():
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '__dict__'. Did you mean: '__dir__'?
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7d154b4a44a0>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 0.337 seconds (init: 0.092, invoke: 0.245)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 7942 in cache file under /home/knauer/.azure/telemetry/20250424160700780
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/__init__.py /home/knauer/.azure /home/knauer/.azure/telemetry/20250424160700780"
telemetry.process: Return from creating process 445580
telemetry.main: Finish creating telemetry upload process.

Expected behavior

The configuration for kubectl must be created

Environment Summary

{
  "azure-cli": "2.71.0",
  "azure-cli-core": "2.71.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "aks-preview": "14.0.0b4"
  }
}

Additional context

Ubuntu 24.04

@edknauer edknauer added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Apr 24, 2025
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 24, 2025

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. AKS az aks/acs/openshift Service Attention This issue is responsible by Azure service team. Auto-Assign Auto assign by bot labels Apr 24, 2025
@alyssa1303
Copy link

Hi! We're also seeing issue with az aks create command

az aks create -g
│ 122149478-3acd042a -n vms-pool --location
│ australiaeast --tier standard --no-ssh-key --kubernetes-version 1.32
│ --nodepool-name default --node-count 1 --node-vm-size Standard_D8ds_v5
│ --vm-set-type VirtualMachines --network-plugin azure --network-plugin-mode
│ overlay --pod-cidr 10.240.0.0/12 --node-osdisk-type Ephemeral
│ --enable-managed-identity': exit status 1. Output: ERROR: The command
│ failed with an unexpected error. Here is the traceback:
│ ERROR: 'NoneType' object has no attribute '__dict__'
│ Traceback (most recent call last):
│   File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
│     cmd_result = self.invocation.execute(args)
│                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│   File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
│     self.commands_loader.load_arguments(command)
│   File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 549, in load_arguments
│     loader.load_arguments(command)  # this adds entries to the argument registries
│     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│   File "/opt/az/azcliextensions/aks-preview/azext_aks_preview/__init__.py", line 45, in load_arguments
│     load_arguments(self, command)
│   File "/opt/az/azcliextensions/aks-preview/azext_aks_preview/_params.py", line 429, in load_arguments
│     k8s_support_plans = self.get_models(
│                         ^^^^^^^^^^^^^^^^
│   File "/opt/az/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 804, in get_models

@surajssd
Copy link
Member

surajssd commented Apr 24, 2025

Same issue on OSX as well while doing az aks nodepool add ...

@surajssd
Copy link
Member

surajssd commented Apr 24, 2025

downgrading aks-preview extension worked for me:

az extension remove --name aks-preview
az extension add --name aks-preview --version 14.0.0b3

@jpayne3506
Copy link

Seeing this on 22.04 as well.

sprt added a commit to kata-containers/kata-containers that referenced this issue Apr 24, 2025
The AKS CLI recently introduced a regression that prevents using
aks-preview extensions (Azure/azure-cli#31345), and hence create
CI clusters.

To address this, we temporarily hardcode the last known good version of
aks-preview.

Note that I removed the comment about this being a Mariner requirement,
as aks-preview is also a requirement of AKS App Routing, which will
be introduced soon in #11164.

Signed-off-by: Aurélien Bombo <[email protected]>
@surajssd
Copy link
Member

I am not sure if this should be filed in the repo: https://github.com/Azure/azure-cli-extensions

@FumingZhang
Copy link
Member

FumingZhang commented Apr 25, 2025

Please run pip install azure-mgmt-core==1.5.0 in your python environment as a workaround.
Raised issue #31322 to cli team to completely fix the problem.

@surajssd
Copy link
Member

I am not sure if this should be filed in the repo: https://github.com/Azure/azure-cli-extensions

Corresponding issue on the repo: Azure/azure-cli-extensions#8691

@KarthikDev
Copy link

I can see forcing pip install azure-mgmt-core==1.5.0, but it didn't help me.

this worked for me: az extension add --name aks-preview --version 14.0.0b3

@mbifeld
Copy link
Member

mbifeld commented Apr 28, 2025

The root problem should be fixed in #31322 and will be available in the next az cli version on May 6th.

@surajssd
Copy link
Member

So with the new release this issue was fixed, all you need to do now is:

az extension update --name aks-preview

@mbifeld
Copy link
Member

mbifeld commented May 1, 2025

Closing as new aks-preview version has the fix.

@mbifeld mbifeld closed this as completed May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS az aks/acs/openshift Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

8 participants