![](/style/images/good.png)
1
![](/style/images/bad.png)
docker k8s 使用记录
source link: https://yazhen.me/_posts/2021/k8s%E6%97%A5%E5%BF%97/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
docker k8s 使用记录
By王亚振
发布于: 2021年09月20日
docker
直接删除所有本地镜像
docker rmi `docker images -q`
批量删除指定名称 xxx-web
docker rmi `docker images | grep xxx-web | awk '{print $3}'`
批量删除 构建失败的镜像
docker rmi $(docker images | grep "none" | awk '{print $3}')
删除所有停止的容器
docker rm $(docker ps -aq)
第一步 根据 yaml 文件 创建对应的 deploy
kt create -f deployment.yaml
pod 上层是 deploy,控制 pod 的扩展,svc是控制 pod 的访问,pod ip 地址变化后,通过svc可以固定的访问
删除 pod 命令
kt delete pod [pod-name]
删除 pod 后 会自动重启一个新的pod服务
要想删除pod 得要删除 deploy
kt delete deploy [deploy-name]
对应的pod 也会删掉
登录 pod
ktx exec -it [pod-id] -- /bin/sh
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK