kubernetes/kops · error
GroupName is required
Error message
GroupName is required
What it means
RunDeleteInstanceGroup requires the name of the instance group to delete via options.GroupName. If it is empty, the command aborts immediately before contacting the cluster. This is a mandatory-input guard in the kOps CLI.
Source
Thrown at cmd/kops/delete_instancegroup.go:127
}
}
return RunDeleteInstanceGroup(ctx, f, out, options)
},
}
cmd.Flags().BoolVarP(&options.Yes, "yes", "y", options.Yes, "Specify --yes to immediately delete the instance group")
return cmd
}
// RunDeleteInstanceGroup runs the deletion of an instance group
func RunDeleteInstanceGroup(ctx context.Context, f *util.Factory, out io.Writer, options *DeleteInstanceGroupOptions) error {
// TODO make this drain and validate the ig?
// TODO implement drain and validate logic
groupName := options.GroupName
if groupName == "" {
return fmt.Errorf("GroupName is required")
}
cluster, err := GetCluster(ctx, f, options.ClusterName)
if err != nil {
return err
}
clientset, err := f.KopsClient()
if err != nil {
return err
}
group, err := clientset.InstanceGroupsFor(cluster).Get(ctx, groupName, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("error reading InstanceGroup %q: %v", groupName, err)
}
if group == nil {
return fmt.Errorf("InstanceGroup %q not found", groupName)View on GitHub (pinned to 4c8573c808)
Solutions
- Pass the instance group name as a positional argument: kops delete instancegroup <name> --name <cluster>
- Verify the group exists with `kops get instancegroups` and re-run with the exact name
- In code, set DeleteInstanceGroupOptions.GroupName before calling RunDeleteInstanceGroup
Example fix
// before kops delete instancegroup --name mycluster.k8s.local // after kops delete instancegroup nodes --name mycluster.k8s.local
Defensive patterns
Strategy: validation
Validate before calling
if options.GroupName == "" {
return fmt.Errorf("GroupName is required")
} Prevention
- Always pass the instance group name as a positional argument
- Guard shell variables with ${IG:?} before interpolating into the command
- List groups with `kops get instancegroups` to confirm names before deleting
When it happens
Trigger: Calling `kops delete instancegroup` (or RunDeleteInstanceGroup programmatically) without a positional group-name argument and without --name, so options.GroupName resolves to "".
Common situations: Typing `kops delete instancegroup` with no argument; scripting the command with a shell variable that is empty; forgetting that --name sets the cluster, not the group.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- at least one channel URL is required
- invalid InstanceGroup name: %v
- must specify %q label with cluster name to create instanceGr
- cluster %q not found
- instanceGroup %q already exists
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/b7a1507f2c4cacc5.
Report an issue: GitHub.