一。docker相关命令
1.查看所有镜像
docker images
2.查看docker运行的容器
docker ps
docker ps -a
3.镜像导入导出
docker load -i 镜像名
docker save -o 镜像包名 镜像名:tag
4.更改镜像tag命令
docker tag 原镜像名:原tag 新镜像名:新tag
5.把镜像push到本地
docker push 镜像名:tag
6.下载镜像
docker pull 镜像名:tag
7.容器启动命令
docker run
8.容器提交成镜像
docker commit 容器id 镜像名:tag
9.容器删除
docker rm -f 容器名
10.镜像删除
docker rmi -f 镜像名
11.进入容器
deocker exec –it 容器名 bash
12.执行build命令制作镜像
docker build -t imos-ms:v1 .
二。kubernetes相关命令
-
kubectl get nodes ----查看节点信息
-
kubectl get pods ----查看pod信息
-
kubectl get pods -o wide ----查看pods的运行详细信息
-
kubectl get pod imos-vm-0 -o yaml ----查看pods定义的详细信息
-
kubectl get service ----查看service的信息
-
kubectl get pv ----查看PV的信息
-
kubectl get pod -n kube-system ------查看系统服务信息
-
kubectl exec [PODNAME] env ----查看运行的pod的环境变量
-
kubectl exec -it [PODNAME] bash ----进入容器
-
kubectl logs [PODNAME] ----查看容器的日志
-
kubectl describe node [NODENAME] ----查看节点的资源
-
kubectl describe pod [PODNAME] ----显示Pod的详细信息,特别是查看pod无法创建时候的日志
-
kubectl get pod --all-namespaces -o wide ----查看所有命名空间下的所有pod
-
创建pod
kubectl create -f rbac-config.yaml
删除pod
[root@test2 ~]# kubectl get pod -n jenkins
NAME READY STATUS RESTARTS AGE
jenkins2-8698b5449c-grbdm 1/1 Running 0 8s
[root@test2 ~]# kubectl delete pod jenkins2-8698b5449c-grbdm -n jenkins
pod “jenkins2-8698b5449c-grbdm” deleted
查看pod仍然存储
[root@test2 ~]# kubectl get pod -n jenkins
NAME READY STATUS RESTARTS AGE
jenkins2-8698b5449c-dbqqb 1/1 Running 0 8s
[root@test2 ~]#
删除deployment
[root@test2 ~]# kubectl get deployment -n jenkins
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
jenkins2 1 1 1 1 17h
[root@test2 ~]# kubectl delete deployment jenkins2 -n jenkins
再次查看pod消失
deployment.extensions “jenkins2” deleted
[root@test2 ~]# kubectl get deployment -n jenkins
No resources found.
[root@test2 ~]#
[root@test2 ~]# kubectl get pod -n jenkins
No resources found.