Forked from rvanbutselaar/OpenShift 4 oneliners
Last active
December 9, 2021 12:42
-
-
Save alyfantisd/8d67e12ced98840c39e1e26bb67df9fa to your computer and use it in GitHub Desktop.
OpenShift 4 oneliners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aanmaken van een extra / nieuwe master node (master-2) op bais van (master-0): | |
oc -n openshift-machine-api get machine sbx42-69jrk-master-0 -o json --export| sed -e s/master-0/master-2/g | jq 'del(.metadata.annotations)' | oc -n openshift-machine-api create -f - | |
# info ophalen over het cluster | |
oc get infrastructure cluster -o yaml | |
# delete completed (deployment) pods | |
oc delete po --field-selector=status.phase==Succeeded | |
# info over deploymentconfigs met cpu/memory requests & limits | |
oc get dc -o json | jq -r --arg ns 'Namespace: ' --arg dc 'DeploymentConfig: ' '.items[] | $ns + .metadata.namespace, $dc + .metadata.name, .spec.template.spec.containers[].resources' | |
oc get dc -o json --all-namespaces | jq -r --arg ns 'Namespace: ' --arg dc 'DeploymentConfig: ' '.items[] | $ns + .metadata.namespace, $dc + .metadata.name, .spec.template.spec.containers[].resources' | |
oc get dc -o json | jq -r --arg ns 'Namespace: ' --arg dc 'DeploymentConfig: ' '.items[] | select(.spec.template.spec.containers[].resources=={}) | $ns + .metadata.namespace, $dc + .metadata.name, .spec.template.spec.containers[].resources' | |
oc get dc -o json --all-namespaces | jq -r --arg ns 'Namespace: ' --arg dc 'DeploymentConfig: ' '.items[] | select(.spec.template.spec.containers[].resources=={}) | $ns + .metadata.namespace, $dc + .metadata.name, .spec.template.spec.containers[].resources' | |
# get pods & pvc | |
oc get po -o json | jq -c '.items[] | {name: .metadata.name, namespace: .metadata.namespace, claimName:.spec.volumes[] | select( has ("persistentVolumeClaim") ).persistentVolumeClaim.claimName }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment