# parent.yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
name: some-parent
namespace: default
data: {}
# children.yaml
---
apiVersion: v1
kind: ConfigMap
metadata:
name: some-child-1
namespace: default
ownerReferences:
- apiVersion: v1
kind: ConfigMap
name: some-parent
uid: PARENT_UID
data: {}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: some-child-2
namespace: default
ownerReferences:
- apiVersion: v1
kind: ConfigMap
name: some-parent
uid: PARENT_UID
data: {}
kubectl apply -f parent.yaml
parentUID=$(kubectl get configmap/some-parent -o jsonpath='{.metadata.uid}')
kubectl apply -f <(sed "s/PARENT_UID/$parentUID/" children.yaml)
kubectl get configmaps
kubectl delete configmap some-parent
kubectl get configmaps