{"record":{"id":"a13cec92cd1e31f3","repo":"kubernetes/kops","slug":"exactly-one-admin-ssh-public-key-can-be-specifie","errorCode":null,"errorMessage":"exactly one 'admin' SSH public key can be specified when running with AWS; please delete a key using `kops delete secret`","messagePattern":"exactly one 'admin' SSH public key can be specified when running with AWS; please delete a key using `kops delete secret`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/apply_cluster.go","lineNumber":456,"sourceCode":"\tcase kops.CloudProviderDO:\n\t\t{\n\t\t\tif len(sshPublicKeys) == 0 && (c.Cluster.Spec.SSHKeyName == nil || *c.Cluster.Spec.SSHKeyName == \"\") {\n\t\t\t\treturn nil, fmt.Errorf(\"SSH public key must be specified when running with DigitalOcean (create with `kops create secret --name %s sshpublickey admin -i ~/.ssh/id_rsa.pub`)\", cluster.ObjectMeta.Name)\n\t\t\t}\n\t\t}\n\tcase kops.CloudProviderAWS:\n\t\t{\n\t\t\tawsCloud := cloud.(awsup.AWSCloud)\n\n\t\t\taccountID, partition, err := awsCloud.AccountInfo(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tmodelContext.AWSAccountID = accountID\n\t\t\tmodelContext.AWSPartition = partition\n\n\t\t\tif len(sshPublicKeys) > 1 {\n\t\t\t\treturn nil, fmt.Errorf(\"exactly one 'admin' SSH public key can be specified when running with AWS; please delete a key using `kops delete secret`\")\n\t\t\t}\n\t\t}\n\n\tcase kops.CloudProviderAzure:\n\t\t{\n\t\t\tif !featureflag.Azure.Enabled() {\n\t\t\t\treturn nil, fmt.Errorf(\"azure support is currently alpha, and is feature-gated. Please export KOPS_FEATURE_FLAGS=Azure\")\n\t\t\t}\n\n\t\t\tif len(sshPublicKeys) == 0 {\n\t\t\t\treturn nil, fmt.Errorf(\"SSH public key must be specified when running with AzureCloud (create with `kops create secret --name %s sshpublickey admin -i ~/.ssh/id_rsa.pub`)\", cluster.ObjectMeta.Name)\n\t\t\t}\n\n\t\t\tif len(sshPublicKeys) != 1 {\n\t\t\t\treturn nil, fmt.Errorf(\"exactly one 'admin' SSH public key can be specified when running with AzureCloud; please delete a key using `kops delete secret`\")\n\t\t\t}\n\t\t}\n\tcase kops.CloudProviderOpenstack:","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/apply_cluster.go#L438-L474","documentation":"For AWS clusters kOps uploads exactly one 'admin' SSH key pair; the state store contains more than one admin sshpublickey, making the choice ambiguous, so the apply is rejected.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/apply_cluster.go:456 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["List keys with `kops get secrets` and remove extras: `kops delete secret sshpublickey <name>`","Keep exactly one admin public key in the state store"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}