1kubectl get configmap kafka-default-config -o yaml | grep -oP '(replication[fF]actor[:|=].\d{0,4})'
2> OUTPUT: replicationFactor=3
1kubectl get ingress nginx -n test -o yaml | grep apiVersion:
2> OUTPUT: apiVersion: networking.k8s.io/v1
You can automatize like below which helps you to find for all of your resources
1!/bin/bash
2# resource can be configmaps, deployments, pods, ingress etc.
3resource=configmaps
4ns=default
5resourceNames=( $(kubectl get $resource -n $ns | awk 'NR!=1 {print $1}') )
6ind=1
7for i in "${resourceNames[@]}"
8do
9 echo "$ind --> fetching $i"
10 kubectl get $resource $i -n $ns -o yaml | grep -oP '(replication[fF]actor[:|=].\d{0,4})'
11 echo ""
12 ((ind+=1))
13done