filmov
tv
[BTBS] How to use JSONPATH and Go-template in kubernetes/openshift?

Показать описание
Hi Welcome to BTBS.
Today, I will talk about template output in kubernetes and openshift.
As a kubernetes/openshift administrator, what kind of command do you use the most?
Is it oc get pod/ kubectl get namespace?
That is very typical command lines that you usually use. However, when you try to get some specific data from object or list, what do you use?
In my case, I used to bash command like awk, grep, sed and so on because those commands are very failiar to me.
But, oc and kubectl already has a good feature to filter data and manipulate data by template.
Today, I will show you 10 command lines to understand jsonpath and go-template in kuberentes and openshift.
1. Get single string (Gather clusterIP from service object)
2. Get single string from list
jsonpath type
go-template type
template string
3. Get the word that match your condition( Gather pod names that are not running state in a project)
4. Get the word that match your condition by go-template (Gather pod names that are not running state in all projects).
5. Clean all pods that are not running state.
json-path style:
go-template style:
6. Gather pod information which are not running state.
7. Gather Elastic Search Data Usage
8. Gather Elastic Search Logging Image version
9. Gather Metrics Image version
10. Gather map value like environment value?
11. Gather string with complex data.
12. Delete orphan Docker images
Today, I will talk about template output in kubernetes and openshift.
As a kubernetes/openshift administrator, what kind of command do you use the most?
Is it oc get pod/ kubectl get namespace?
That is very typical command lines that you usually use. However, when you try to get some specific data from object or list, what do you use?
In my case, I used to bash command like awk, grep, sed and so on because those commands are very failiar to me.
But, oc and kubectl already has a good feature to filter data and manipulate data by template.
Today, I will show you 10 command lines to understand jsonpath and go-template in kuberentes and openshift.
1. Get single string (Gather clusterIP from service object)
2. Get single string from list
jsonpath type
go-template type
template string
3. Get the word that match your condition( Gather pod names that are not running state in a project)
4. Get the word that match your condition by go-template (Gather pod names that are not running state in all projects).
5. Clean all pods that are not running state.
json-path style:
go-template style:
6. Gather pod information which are not running state.
7. Gather Elastic Search Data Usage
8. Gather Elastic Search Logging Image version
9. Gather Metrics Image version
10. Gather map value like environment value?
11. Gather string with complex data.
12. Delete orphan Docker images
Комментарии