Skip to content

Instantly share code, notes, and snippets.

@Huge
Last active October 9, 2019 13:12
Show Gist options
  • Save Huge/602148942be7734ae209c75f88fe57ae to your computer and use it in GitHub Desktop.
Save Huge/602148942be7734ae209c75f88fe57ae to your computer and use it in GitHub Desktop.
while true; do kubectl get pods -w || echo Restarted... && clear; done # Still draws blank when logged out..
#|-similar:
while true; do vpn; sleep 1; done
alias clis='fc -ln -1 |xargs echo -n|xsel -ib' #Better without newline, copying to Ctrl+V CLIPboard.
docker run -it openshift/origin-cli # Then inside: while true; do kubectl get pods -w || echo Restarted... && clear; done
#Debugging a container/pod with partly random name:
P=$(kubectl get pods --namespace=cicd -o=custom-columns=AVAILABLE:.metadata.name --no-headers |ag maven) && oc exec -it $P bash
#Evicted pods deletion from a single namespace:
kubectl get pods -n cicd-components | grep Evicted | awk {print $1} | xargs kubectl delete pod -n cicd-components
# https://gist.github.com/psxvoid/71492191b7cb06260036c90ab30cc9a0 inspired
#Readiness probes checking
kubectl describe pod -n cicd-jenkins jenkins-6fb87d56c6-gwmkr | ag -A2 "^ Ready" # Grabs the right status at the back of state description. prbly a lame way( compared to some .json parsing).
kubectl describe pod nexus-222 |ag QoS #will become Guaranteed if you set for both the cpu and memory tdeallocatehe limits to same value as requests. I like that less than the PriorityClass concept introduced lately to K8s.
#Awesome easy way to redeploy on plain K8s:
kubectl patch deployment <nexusOrWhatEver,EvenFromHelm> -p "{\"spec\": {\"template\": {\"metadata\": { \"labels\": { \"redeploy\": \"$(date +%s)\"}}}}}"
kubectl scale --replicas=0 deployment nexus && oc scale --replicas=1 deployment nexus # Sometimes we need this with the Helm lame to resolve double spawning of pods./
# Azure crank to see Readiness go off..if we can select the right node...( something with selector=<nodeLabel>), I don't know.
az vm stop --resource-group MC_mv-testProbes_aks-cluster_eastus --name aks-agentpool-13480326-0 # and use same with `vm deallocate` to stop like Portal does or `start` to get it running from both cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment