Hunter的大杂烩 技术学习笔记

2021-09-03

linux命令行使用json格式化工具

Filed under: 技术话题 — hunter @ 8:27 pm

from https://zhuanlan.zhihu.com/p/77177160


{"word": "hello",
"source": [ {
"firstName": "John",
},
{
"firstName": "Hunter",
},
{
"firstName": "Tony",
}]
}

(more…)

k8s简单脚本

Filed under: 技术话题 — hunter @ 7:37 pm

把常用命令用脚本简化

 
[code]
#!/bin/sh

if [ $# -lt 2 ]; then
echo "USAGE: $0 <logs|pod|search> <podname>"
exit 0
fi

if [ $1 = "search" ];then
kubectl get -n <namespace> -o wide pods|grep $2
elif [ $1 = "pod" ];then
kubectl describe pod -n <namespace> $2
elif [ $1 = "logs" ];then
kubectl logs -n <namespace> -f $2
elif [ $1 = "cmd" ];then
kubectl exec -it -n <namespace> $2 — /bin/bash
elif [ $1 = "restart" ];then
#kubectl get pod $2 -n <namespace> -o yaml |kubectl replace –force -f –
kubectl rollout restart deployment -n <namespace> $2
fi

[/code]

« Newer Posts

Powered by WordPress