Difference between revisions of "Jsonpath"
Jump to navigation
Jump to search
(3 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
Tjp67Ib3c2PxvGoD6SH1pjTtnlq6X4XvrXo4xxx | Tjp67Ib3c2PxvGoD6SH1pjTtnlq6X4XvrXo4xxx | ||
− | [[kubectl get pods]] --selector=app=your-app-name -o=jsonpath='{.items[0].metadata.name}' | + | [[kubectl get pods]] [[--selector]]=app=your-app-name -o=jsonpath='{.items[0].metadata.name}' |
[[List all containers]] in all [[pod]]: | [[List all containers]] in all [[pod]]: | ||
Line 11: | Line 11: | ||
[[kubectl get pods]] YourPOD -o jsonpath='{.spec.containers[*].name}' | [[kubectl get pods]] YourPOD -o jsonpath='{.spec.containers[*].name}' | ||
− | export POD_NAME=$(kubectl get pods --namespace default [[-l]] "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}") | + | export POD_NAME=$([[kubectl get pods]] --namespace default [[-l]] "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}") |
+ | |||
+ | [[kubectl config view --minify]] | ||
== See also == | == See also == | ||
* {{JSON}} | * {{JSON}} | ||
+ | * {{kubectl}} | ||
[[Category:JSON]] | [[Category:JSON]] |
Latest revision as of 21:17, 28 September 2022
kubectl get secret --namespace default grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo Tjp67Ib3c2PxvGoD6SH1pjTtnlq6X4XvrXo4xxx
kubectl get pods --selector=app=your-app-name -o=jsonpath='{.items[0].metadata.name}'
List all containers in all pod:
kubectl get pods -o jsonpath='{range .items[*]}{"pod: "}{.metadata.name}{"\n"}{range .spec.containers[*]}{"\tname: "}{.name}{"\n\timage: "}{.image}{"\n"}{end}'
List all containers in a pod:
kubectl get pods YourPOD -o jsonpath='{.spec.containers[*].name}'
export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
kubectl config view --minify
See also[edit]
- JSON,
jq, jid, mlr
, JWT, BSON, Miller, Content-type:,application/json
,BadJSON
, Webhook, jsonc, ndjson,import json
, Google Custom Search JSON API,jsonpath
, JSON-LD, JSON tree, JSON-RPC kubectl
: [cp | config | create
|delete
|edit | explain |
apply
|exec
|get
|set
|drain | uncordon | rolling-update
|rollout
|logs
|run
|auth
|label | annotate
|version
|top
|diff
|debug
|replace
|describe
|port-forward | proxy
|scale
|rollout
|api-resources
| expose deployment | expose | patch | attach | get endpoints | ~/.kube/config | kubectl logs --help | kubectl --help, kubectl-convert, kubectl autoscale, kubectl.kubernetes.io
Advertising: