I've made a bit of research on this topic and I found 2 possible solutions to retrieve all the resources that were created by config-connector
:
$ kubectl api-resources
way
$ kubectl get-all
/ketall
way with labels
(please see the explanation as it's not installed by default)
The discussion that is referencing similar issue can be found here:
$ kubectl api-resources
As pointed in the comment I made you can use the following expression:
kubectl get crds --selector cnrm.cloud.google.com/managed-by-kcc=true -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | xargs -n 1 kubectl get --ignore-not-found
Dissecting this solution:
kubectl get crds --selector cnrm.cloud.google.com/managed-by-kcc=true
- retrieve the
Customer Resource Definitions
that have a matching selector
-o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'
- use the
jsonpath
to retrieve only the value stored in .metadata.name
key (get the name of the crd)
| xargs -n 1 kubectl get
- pipe the output to the xargs and use each
CRD
retrieved from previous command to run $ kubectl get <RESOURCE>
--ignore-not-found
- do not display a message about missing resource
This command could also be altered to suit the specific needs as it's shown in the question.
A side note!
Similar command is referenced in the github link I pasted above:
$ kubectl get-all
/ketall
Above commands can be used to retrieve all of the resources in the cluster. They are not available in default kubectl
and they need additional configuration.
More reference about the installation can be found in this github page:
Using the approach described in the official Kubernetes documentation:
Labels are intended to be used to specify identifying attributes of objects
Kubernetes.io: Docs: Concepts: Overview: Working with objects: Labels
You can label those resources created by config connector (I know that you would like to avoid it) and look for this resources like:
$ kubectl get-all -l look=here
NAME NAMESPACE AGE
storagebucket.storage.cnrm.cloud.google.com/config-connector-bucket config-connector 135m
storagebucket.storage.cnrm.cloud.google.com/config-connector-bucket-test config-connector 13s
This resources have the .metadata.labels.look=here
added to it's definitions.
Additional resources: