diff --git a/kubectl-fdb/cmd/exclusion_status.go b/kubectl-fdb/cmd/exclusion_status.go index ef644ecd9..6c55e0609 100644 --- a/kubectl-fdb/cmd/exclusion_status.go +++ b/kubectl-fdb/cmd/exclusion_status.go @@ -22,6 +22,7 @@ package cmd import ( "encoding/json" + "fmt" "sort" "time" @@ -81,6 +82,10 @@ func newExclusionStatusCmd(streams genericclioptions.IOStreams) *cobra.Command { return err } + if len(pods.Items) == 0 { + return fmt.Errorf("no running Pods are found for cluster: %s/%s", cluster.Namespace, cluster.Name) + } + // TODO get the pod randomly err = getExclusionStatus(cmd, config, clientSet, pods.Items[0].Name, namespace, ignoreFullyExcluded, interval) if err != nil {