Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

az capi create workercluster error #200

Open
zylxjtu opened this issue Sep 8, 2023 · 1 comment
Open

az capi create workercluster error #200

zylxjtu opened this issue Sep 8, 2023 · 1 comment

Comments

@zylxjtu
Copy link

zylxjtu commented Sep 8, 2023

Can I ask your kind help on the following errors when trying to run the az capi command?

Command: az capi create -g wcctcapz -n wcctworkercapz -l eastus --debug

Errors:

for: "wcctworkercapz.yaml": error when patching "wcctworkercapz.yaml": admission webhook "validation.azuremachinetemplate.infrastructure.cluster.x-k8s.io" denied the request: AzureMachineTemplate.infrastructure.cluster.x-k8s.io "wcctworkercapz-md-0" is invalid: AzureMachineTemplate.spec.template.spec: Invalid value: v1beta1.AzureMachineTemplate{TypeMeta:v1.TypeMeta{Kind:"AzureMachineTemplate", APIVersion:"infrastructure.cluster.x-k8s.io/v1beta1"}, ObjectMeta:v1.ObjectMeta{Name:"wcctworkercapz-md-0", GenerateName:"", Namespace:"default", SelfLink:"", UID:"2211c1e0-0c4c-4c5c-8ef3-b005e5152ee7", ResourceVersion:"24755", Generation:2, CreationTimestamp:time.Date(2023, time.September, 7, 23, 31, 20, 0, time.Local), DeletionTimestamp:, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string{"kubectl.kubernetes.io/last-applied-configuration":"{"apiVersion":"infrastructure.cluster.x-k8s.io/v1beta1","kind":"AzureMachineTemplate","metadata":{"annotations":{},"name":"wcctworkercapz-md-0","namespace":"default"},"spec":{"template":{"spec":{"osDisk":{"diskSizeGB":128,"managedDisk":{"storageAccountType":"Premium_LRS"},"osType":"Linux"},"sshPublicKey":"L2hvbWUveXVhbmxpYW5nLy5zc2gvaWRfcnNhLnB1Yg==","vmSize":"Standard_B2s"}}}}\n"}, OwnerReferences:[]v1.OwnerReference{v1.OwnerReference{APIVersion:"cluster.x-k8s.io/v1beta1", Kind:"Cluster", Name:"wcctworkercapz", UID:"4c37e699-ee92-4724-9e4e-22a97dfef280", Controller:(*bool)(nil), BlockOwnerDeletion:(*bool)(nil)}}, Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry{v1.ManagedFieldsEntry{Manager:"manager", Operation:"Update", APIVersion:"infrastructure.cluster.x-k8s.io/v1beta1", Time:time.Date(2023, time.September, 7, 23, 31, 20, 0, time.Local), FieldsType:"FieldsV1", FieldsV1:(*v1.FieldsV1)(0xc000eb7770), Subresource:""}, v1.ManagedFieldsEntry{Manager:"kubectl-client-side-apply", Operation:"Update", APIVersion:"infrastructure.cluster.x-k8s.io/v1beta1", Time:time.Date(2023, time.September, 8, 16, 42, 10, 0, time.Local), FieldsType:"FieldsV1", FieldsV1:(*v1.FieldsV1)(0xc000eb77d0), Subresource:""}}}, Spec:v1beta1.AzureMachineTemplateSpec{Template:v1beta1.AzureMachineTemplateResource{ObjectMeta:v1beta1.ObjectMeta{Labels:map[string]string(nil), Annotations:map[string]string(nil)}, Spec:v1beta1.AzureMachineSpec{ProviderID:(*string)(nil), VMSize:"Standard_B2s", FailureDomain:(*string)(nil), Image:(*v1beta1.Image)(nil), Identity:"None", UserAssignedIdentities:[]v1beta1.UserAssignedIdentity(nil), SystemAssignedIdentityRole:(*v1beta1.SystemAssignedIdentityRole)(nil), RoleAssignmentName:"", OSDisk:v1beta1.OSDisk{OSType:"Linux", DiskSizeGB:(*int32)(0xc001588820), ManagedDisk:(*v1beta1.ManagedDiskParameters)(0xc0013d9d80), DiffDiskSettings:(*v1beta1.DiffDiskSettings)(nil), CachingType:"None"}, DataDisks:[]v1beta1.DataDisk(nil), SSHPublicKey:"L2hvbWUveXVhbmxpYW5nLy5zc2gvaWRfcnNhLnB1Yg==", AdditionalTags:v1beta1.Tags(nil), AdditionalCapabilities:(*v1beta1.AdditionalCapabilities)(nil), AllocatePublicIP:false, EnableIPForwarding:false, AcceleratedNetworking:(*bool)(nil), Diagnostics:(*v1beta1.Diagnostics)(nil), SpotVMOptions:(*v1beta1.SpotVMOptions)(nil), SecurityProfile:(*v1beta1.SecurityProfile)(nil), SubnetName:"", DNSServers:[]string(nil), VMExtensions:[]v1beta1.VMExtension(nil), NetworkInterfaces:[]v1beta1.NetworkInterface{v1beta1.NetworkInterface{SubnetName:"", PrivateIPConfigs:1, AcceleratedNetworking:(*bool)(nil)}}}}}}: AzureMachineTemplate spec.template.spec field is immutable. Please create new resource instead. ref doc: https://cluster-api.sigs.k8s.io/tasks/updating-machine-templates.html

Related settings:

{
"azure-cli": "2.52.0",
"azure-cli-core": "2.52.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"azure-devops": "0.26.0",
"capi": "0.1.5"
}

export AZURE_SSH_PUBLIC_KEY_FILE="$HOME/.ssh/id_rsa.pub"

Related part in the generated yaml template:

kind: AzureMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
metadata:
name: wcctworkercapz-control-plane
spec:
template:
spec:
vmSize: Standard_B2s
osDisk:
osType: Linux
diskSizeGB: 128
managedDisk:
storageAccountType: Premium_LRS
dataDisks:
- nameSuffix: etcddisk
diskSizeGB: 256
lun: 0
sshPublicKey: "L2hvbWUveXVhbmxpYW5nLy5zc2gvaWRfcnNhLnB1Yg=="

@CecileRobertMichon
Copy link
Contributor

Are you using an existing management cluster? Does it have an existing cluster on it?

AzureMachineTemplate spec.template.spec field is immutable. Please create new resource instead.

seems like the template getting applied already exists

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants