command | description |
---|---|
ctrl + a | Goto BEGINNING of command line |
ctrl + e | Goto END of command line |
ctrl + b | move back one character |
This file contains 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
# get inactive rs | |
kubectl get rs | awk '{if ($2=="0") print $0}' | |
# delete inactive rs | |
kubectl get rs | awk '{if ($2=="0") print $1}' | xargs kubectl delete rs | |
# get error job | |
kubectl get job | awk '{if ($2=="0/1") print $0}' | |
# delete error job |
This file contains 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
kubectl get pods -n kube-system -l k8s-app=prometheus-to-sd -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[*].image}{"\n"}{end}' | |
https://kubernetes.io/docs/reference/kubectl/jsonpath/ |
This file contains 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
jq -cr '.[] | "\(.name) \(.)"' test.json | awk '{ file=$1".json"; print $2 > file; close(file); }' |
Short excursion into git --track
, --set-upstream
and --set-upstream-to
.
All examples use the aliases co
for checkout
and br
for branch
.
Setup:
$ git clone [email protected]:AKSW/OntoWiki.git
This file contains 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
# suspend active cronjobs | |
kubectl.exe get cronjob | grep False | awk '{print $1}' | xargs kubectl patch cronjob -p '{"spec" : {"suspend" : true }}' | |
# resume suspended cronjobs | |
kubectl.exe get cronjob | grep True | awk '{print $1}' | xargs kubectl patch cronjob -p '{"spec" : {"suspend" : false }}' |
This file contains 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
schema: "1" # Schema must match for all | |
id: auth | |
metadata: | |
name: Template to deploy auth api | |
variables: | |
- name: k8s-account | |
description: kubernetes account to deploy | |
type: string | |
group: Deployment | |
- name: namespace |
This file contains 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
initContainers: | |
- name: volume-mount-hack | |
image: busybox | |
command: ["sh", "-c", "chown -R 200:200 /nexus"] | |
volumeMounts: | |
- name: <your nexus volume> | |
mountPath: /nexus |
This file contains 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
kubectl get po --all-namespaces | grep Evicted | awk '{print $2, "--namespace", $1}' | xargs kubectl delete pod |