kubectl 操作

kubectl 实现对pod的端口转发

kubectl --namespace drone-service port-forward $POD_NAME 8080:$CONTAINER_PORT

 列出pod使用的镜像:

$ kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" |\
tr -s '[[:space:]]' '\n' |\
sort |\
uniq -c

 附加pod用于调试容器:

kubectl -n NAMESPACE debug POD-CONTAINER-NAME -it --image=busybox

 

 

 

posted @ 2023-11-21 10:08  liu0076  阅读(3)  评论(0编辑  收藏  举报