Skip to content

Instantly share code, notes, and snippets.

@noseka1
noseka1 / mount-nfs-clusterrole.yaml
Last active August 7, 2020 15:55
Allow cluster-wide mounting of NFS volumes
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: mount-nfs
rules:
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
verbs:
@noseka1
noseka1 / JSONPath in kubectl CLI.md
Last active April 23, 2025 08:21
JSONPath in kubectl CLI examples

Examples

$ kubectl get pods -o json
$ kubectl get pods -o jsonpath='{@}'
$ kubectl get pods -o jsonpath='{.items[0]}'
$ kubectl get pods -o jsonpath='{.items[0].metadata.name}'
$ kubectl get pods -o jsonpath="{.items[*]['metadata.name', 'status.capacity']}"
$ kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}'
$ kubectl get pods -o jsonpath='{.items[*].status.podIP}'
@noseka1
noseka1 / Using jq with Kubernetes and OpenShift.md
Last active August 19, 2021 16:37
Using jq with Kubernetes and OpenShift

Examples

$ oc get pod <POD_NAME> -o json | jq -r '.spec.volumes[] | select(.name=="config").secret.secretName'

References

JSONPath in kubectl CLI.md