kubernetes/kops · error
must specify name of keyset promote keypair in
Error message
must specify name of keyset promote keypair in
What it means
The promote keypair command requires the keyset name (e.g. kubernetes-ca, apiserver-aggregator-ca) as the first positional argument. With zero positional args the Args validator returns this error before the command runs.
Source
Thrown at cmd/kops/promote_keypair.go:86
// NewCmdPromoteKeypair returns a promote keypair command.
func NewCmdPromoteKeypair(f *util.Factory, out io.Writer) *cobra.Command {
options := &PromoteKeypairOptions{}
cmd := &cobra.Command{
Use: "keypair {KEYSET [ID] | all}",
Short: promoteKeypairShort,
Long: promoteKeypairLong,
Example: promoteKeypairExample,
Args: func(cmd *cobra.Command, args []string) error {
options.ClusterName = rootCommand.ClusterName(true)
if options.ClusterName == "" {
return fmt.Errorf("--name is required")
}
if len(args) == 0 {
return fmt.Errorf("must specify name of keyset promote keypair in")
}
options.Keyset = args[0]
if len(args) > 2 {
return fmt.Errorf("can only promote to one keyset at a time")
}
if len(args) > 1 {
if options.Keyset == "all" {
return fmt.Errorf("cannot specify ID with \"all\"")
}
options.KeypairID = args[1]
}
return nil
},
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {View on GitHub (pinned to 4c8573c808)
Solutions
- Provide the keyset as the first argument, e.g. `kops promote keypair kubernetes-ca --name <cluster>`
- Use `all` to promote every rotatable keyset: `kops promote keypair all --name <cluster>`
- Quote/verify the shell variable that supplies the keyset name
Example fix
// before kops promote keypair --name mycluster.k8s.local // after kops promote keypair all --name mycluster.k8s.local
Defensive patterns
Strategy: validation
Validate before calling
[ $# -ge 1 ] || { echo "must pass keyset, e.g. kops promote keypair all --name <cluster>"; exit 1; } Prevention
- Quote shell variables supplying the keyset so empties fail visibly
- Use `all` as the default keyset argument in scripts
- Add a usage comment to promotion runbooks
When it happens
Trigger: Running `kops promote keypair --name <cluster>` with no keyset argument at all.
Common situations: Copy-pasting a command and dropping the keyset argument; assuming `all` was the default; shell variable holding the keyset expanded to empty.
Related errors
- cannot specify ID with "all"
- unable to parse argument %q as url
- cannot specify --key with "all"
- cannot specify --primary with "all"
- adding keypair to %q is not supported
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/85c1aeb176f6e28c.
Report an issue: GitHub.