Delete pods by name
kubectl delete pod -n pfm-utilities $(kubectl get pods -n pfm-utilities -ocustom-columns=NAME:.metadata.name | grep manual)
kubectl delete job -n pfm-utilities $(kubectl get job -n pfm-utilities -ocustom-columns=NAME:.metadata.name | grep manual)
oc get nodes --selector='failure-domain.beta.kubernetes.io/zone=eu-de-01'
kubectl get secrets -n baseline \
-l jenkins-cr=p3s-jenkins-jenkins-helm-chart \
-ojson | jq -j '.items[0].data.password' | base64 --decode
kubectl get secrets -n baseline --field-selector=type=Opaque
Debug Pod
kubectl run -i --rm --tty busybox --overrides='
{
"spec": {
"containers": [
{
"name": "busybox",
"image": "busybox:latest",
"args": [
"sh"
],
"stdin": true,
"stdinOnce": true,
"tty": true,
"volumeMounts": [{
"mountPath": "/sometest/store",
"name": "store"
}]
}
],
"volumes": [{
"name":"store",
"emptyDir":{}
}]
}
}
' --image=busybox:latest --namespace=minecraft --restart=Never -- sh
kubectl run -i --rm --tty busybox --overrides='
{
"spec": {
"containers": [
{
"name": "centos",
"image": "centos:7",
"args": [
"sh"
],
"stdin": true,
"stdinOnce": true,
"tty": true,
"nodeSelector": {
"beta.kubernetes.io/arch": "amd64"
},
"volumeMounts": [{
"mountPath": "/sometest/store",
"name": "store"
}]
}
],
"volumes": [{
"name":"store",
"emptyDir":{}
}]
}
}
' --image=centos:7 --namespace=monitoring-presentation --restart=Never -- sh
kubectl run -i --rm --tty busybox --overrides='
{
"spec": {
"containers": [
{
"name": "busybox",
"image": "busybox:latest",
"args": [
"sh"
],
"stdin": true,
"stdinOnce": true,
"tty": true,
"volumeMounts": [
{
"mountPath": "/data",
"name": "store"
}
]
}
],
"volumes": [
{
"name": "store",
"persistentVolumeClaim": {
"claimName": "mc-restored-2"
}
}
]
}
}
' --image=busybox:latest --namespace=minecraft --restart=Never -- sh
hack fix terminated volume
kubectl patch pvc mc-restored -p '{"metadata":{"finalizers":null}}' -n minecraft
Remove Namespaces if Terminating
for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl get ns $ns -ojson | jq '.spec.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -; done