#### openshift list all pods and thier specs (requests/limits) ``` oc get pod -o jsonpath='{range .items[*]}{"SPEC: \n LIMITS : "}{.spec.containers[*].resources.limits}{"\n REQUESTS: "}{.spec.containers[*].resources.requests}{"\n"}{end}' ``` #### openshift list all pods and thier specs with name (requests /limits) ``` oc get pod -o jsonpath='{range .items[*]}{"NAME: "}{.metadata.name}{"\nSPEC: \n LIMITS : "}{.spec.containers[*].resources.limits}{"\n REQUESTS: "}{.spec.containers[*].resources.requests}{"\n\n"}{end}' ``` #### openshift list all nodes and thier corresponding os/kernel verion ``` oc get nodes -o jsonpath='{range .items[*]}{"\t"}{.metadata.name}{"\t"}{.status.nodeInfo.osImage}{"\t"}{.status.nodeInfo.kernelVersion}{"\n"}{end}' ``` #### openshift patch build config with patch ``` oc patch bc/kube-ops-view -p '{"spec":{"resources":{"limits":{"cpu":"1","memory":"1024Mi"},"requests":{"cpu":"100m","memory":"256Mi"}}}}' ``` #### openshift display the images used by Replication Controller ``` oc get rc -n openshift-infra -o jsonpath='{range .items[*]}{"RC: "}{.metadata.name}{"\n Image:"}{.spec.template.spec.containers[*].image}{"\n"}{end}' ``` #### openshift display the requestor for namespace ``` oc get namespace ui-test -o template --template '{{ index .metadata.annotations "openshift.io/requester" }}' ``` #### openshift display all projects and its creator sorted by creator ``` IFS=,; while read data1 data2; do printf "%-60s : %-50s\n" $data1 $data2; done < <( oc get projects -o template \ --template '{{range .items}}{{.metadata.name}},{{index .metadata.annotations "openshift.io/requester"}}{{"\n"}}{{end }}' | sort -t, -k2 ) ``` #### openshift fetch custom column name from metadata ``` oc get rolebinding -o=custom-columns=USERS:.userNames,GROUPS:.groupNames for i in `oc get pv -o=custom-columns=NAME:.metadata.name | grep pvc` ; do oc describe pv $i | grep Path |awk '{print $2}'; done ``` #### openshift-machine-api ``` oc get nodes oc project openshift-machine-api oc get machine -o=custom-columns="name:.metadata.name,Status:status.phase,Address:.status.addresses[1].address,state:status.providerStatus.instanceState" ``` #### scaling up workers ``` oc get machineset oc scale --replicas=1 machineset primary-w5bzm-worker-0 -n openshift-machine-api ``` #### troubleshooting the nodes ``` oc get nodes oc debug node/primary-w5bzm-master-0 # change root to host chroot /host ``` #### adding ``` ["-device","virtio-serial","-chardev","file,id=virtioserial_ovirt11,path=/tmp/virtioserial_ovirt11_journal.log,append=on","-device", "virtserialport,chardev=virtioserial_ovirt11,name=com.coreos.ignition.journal"] ```