Query config file value on deployed cluster K8S

9/4/2019

I got admin rights on our cluster and I want to query the config yaml file which is deployed to the cluster, the file is already applied to the cluster and I want to query the file values of networkPolicy I mean all files with kind kind: NetworkPolicy , is it possible to do it from the terminal ?

In small cluster I can do kubectl get deploy --all-namespaces -o yaml > dep.yaml but in big cluster there is a lot of file/data ....

-- Jenny M
amazon-web-services
azure
google-cloud-platform
kubernetes

1 Answer

9/4/2019

To get the YAML manifests of all NetworkPolicy resources in the cluster:

kubectl get netpol --all-namespaces -o yaml

If you need only some of them, you can filter based on label values or field values with the -l/--selector and --field-selector options.

-- weibeld
Source: StackOverflow