编辑pod版本号等信息
kubectl edit deployment ams-metric -n manage
导出容器内容到文件
docker export 1ceefea8d9ff > calc.tar
加载tar到本地仓库
docker load -i ams-access-1.0.PC5.tar
快速从容器push到镜像仓库
docker commit eafd208f45bf 10.44.29.222:20202/root/feb-service:1.6.1
docker push 10.44.29.222:20202/root/feb-service:1.6.1
修改tag
docker tag ams-access:1.0.PC5 100.107.69.104:20202/root/ams-access:1.0.PC5
push到中心仓库
docker push 100.107.69.104:20202/root/ams-access:1.0.PC5
下载镜像
docker pull 100.107.69.104:20202/root/almmgmtwebsiteimage:1.0.0
镜像保存到文件
docker save 02c8d3460ca0 > lib-roa:1.0.1.tar
查看镜像
docker images|grep ams
删除镜像
docker rmi -f {id}
查看pod信息
kubectl describe pod ams-access-155968346-htz2v -n manage
查看pod详情
kubectl get po ams-access-155968346-htz2v -o json -n manage
查看配置
kubectl get configmap -n manage|grep ams
返回mysql-configmap-amsdbsvr-manage 1 10m
删除配置
kubectl delete configmap -n manage mysql-configmap-amsdbsvr-manage
注册ber
sh register.sh registry
去注册ber
sh register.sh unregistry
kubectl get statefulset -owide -n om
1、主部署节点查询pod
kubectl get pod -o wide -n manage|grep ams
2、登录容器
1)kubectl exec -ti podID -n manage sh
2)知道在哪个节点-->纳管节点(容器运行节点)
docker ps |grep
docker exec -ti dockerID sh
3)获取node ip
先通过
kubectl get pod -o wide -n manage|grep ams
得到nodeID
kubectl describe nodes {{NODEID}} -n om|grep Address
kubectl describe nodes {{NODEID}} -n manage|grep Address
kubectl get pod -o wide -n om|grep hrs-er
kubectl get pod -o wide -n manage|grep hrs-er
主管理节点,可以使用kubectl
export PATH=$PATH:/var/paas/kubernetes/
export HELM_HOME=/var/paas/helm/
命名空间(租户侧manage,运维侧om
1.查看部署pod(实例)
主节点上执行命令:
kubectl get pod -n {{命名空间}}
kubectl get pod -n manage|grep ams
删除pod
kubectl delete pod {{pod名称}} -n {{命名空间}}
kubectl delete pod ams-alarm-2021368205-pqsht -n manage
强制删除
--grace-period=0 --force
kubectl delete pod ams-alarm-2021368205-pqsht --grace-period=0 --force -n manage
查看pod详情
kubectl describe pod {{pod名称}} -n {{命名空间}}
kubectl describe pod ams-alarm-2021368205-pqsht -n manage
2.查看节点信息:
主节点上执行命令:
kubectl get node -n {{命名空间}}
kubectl get node -n manage
kubectl edit node om-cluster1-36919a5e-2b0-q98qw -n om
manage-cluster1-558f791e-cqt3x 就是租户侧的节点名称
3.查看节点详情:
主节点上执行命令:
kubectl describe nodes {{节点名称}} -n {{命名空间}}
kubectl describe nodes manage-cluster1-558f791e-cqt3x -n manage
4.查看服务所在节点信息:
主节点上执行命令:
kubectl get pod -o wide -n {{命名空间}}
kubectl get pod -o wide -n manage|grep ams
5.查看容器对应的ID:
登陆对应的部署节点。执行命令:
docker ps
6.登陆容器:
docker exec -ti {{容器ID}} sh
docker exec -ti 3cbf461b1c35 sh
7.重启服务
在容器内部 /var/paas/jobs/{{微服务}}/bin 目录下执行对应的start脚本
sh start.sh restart
8.替换class文件
将需要替换的文件拷贝到微服务所在节点执行命令
docker cp {{对应的class文件}} {{容器ID}}:{{容器内多要替换文件所在目录}}
docker cp QueryDataBaseService.class 71d6c9495150:/var/paas/jobs/ams-metric-1.0.0/webapp/WEB-INF/classes/com/huawei/monitor/metricsvc/rest/service
9.查看数据库
首先执行:kubectl exec {{数据库实例}} -ti -n {{命名空间}} -- bash
kubectl exec amsdbsvr-manage-0 -ti -n manage -- bash
然后执行:mysql -hamsdbsvr-manage -P3306 -udbuser -pAdmin@123
在执行show databases; 选择对应的数据库。
10.其他项
各个微服务日志所在目录,可以再容器内部看也可以在容器外
对应的目录,AMS为例,在var/paas/sys/log/ams/{{命名空间}}/{{微服务}}/log
docker build -t swr.cn-north-1.myhuaweicloud.com/d00105737/confd:v1.0.8 .
docker run --rm -it --entrypoint /bin/ls swr.cn-north-1.myhuaweicloud.com/d00105737/confd:v1.0.8 /sbin
docker build -t swr.cn-north-1.myhuaweicloud.com/d00105737/cloudeasy-monitor-dev:v1.0.83 -f cloudeasy-monitor/Dockerfile ./cloudeasy-monitor/
create swr repo https://swr.cn-north-1.myhuaweicloud.com/dockyard/v2/domains/d00105737/namespaces/d00105737/repositories?repository=cloudeasy-monitor-dev&is_public=false&description=&category=other
查看日志
docker logs -f --tail=100 83a66561b52f
k8s查看域名配置
vi /etc/resolv.conf
maven编译跳过测试
mvn clean install -X -Dmaven.test.skip=true
查看docker容器详细信息
docker inspect {id}