clear pod ownerRefs before creating debug pod
@@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
kapierrors "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
@@ -601,6 +602,9 @@ func (o *DebugOptions) transformPodForDebug(annotations map[string]string) (*kap
pod.CreationTimestamp = metav1.Time{}
pod.SelfLink = ""
+ // clear pod ownerRefs
+ pod.ObjectMeta.OwnerReferences = []v1.OwnerReference{}
+
return pod, originalCommand
}
