1.从镜像里拷贝文件
/usr/bin/docker run --rm -v /root:/temp image /bin/cp -f /xxx.tar.gz /temp/xxx.tar.gz
2.rbd status命令提示没有ceph.conf
rbd status test-data/kubernetes-dynamic-pvc-23922029-3f95-4b6b-a6fa-f8f77abb28c7 --user admin -m 10.10.18.65:6789 --keyfile /root/cephkey
3.nfs手动挂载命令
mount -t nfs 10.10.10.10:/nfs /root/nfs
4.cephfs手动挂载命令
mount -t ceph 10.10.10.10:6789:/ /root/cephroot/ -o name=admin,secret=AQAUOOWD902LKJSDA81P8RkO3570LvsD3Kbzrcw==
5.apt-get仅下载包
rm -rf /var/cache/apt/archives/*
apt-get -d install <包名>
cd /var/cache/apt/archives
6.yum仅下载包
sudo yum install --downloadonly --downloaddir=/root/package/nano nano
7.rbd查找占用进程及卸载
grep " /dev/rbd0 " /proc/*/task/*/mountinfo | head -n 1 | awk '{print $1}' | awk -F "proc/" '{print $2}' | awk -F "/task" '{print $1}'
#!/bin/bash
unmapByAnotherWay(){
mountTask=`grep " /dev/$1 " /proc/*/task/*/mountinfo | head -n 1 | awk '{print $1}' | awk -F "proc/" '{print $2}' | awk -F "/task" '{print $1}'`
kill -9 ${mountTask}
rbd unmap /dev/$1
}
device=`rbd showmapped | grep $1 | grep "/dev" | awk '{printf "%s\n",$5}' | awk -F '/dev/' '{print $2}'`
if [ -n "$device" ]; then
# umount
proc=`ps -ef | grep jbd2 | grep ${device} | head -n 1 | awk '{printf "%s\n",$3}'`
rbd_dirs=`cat /proc/${proc}/mounts | grep ${device} | awk '{printf "%s\n", $2}'`
for dir in ${rbd_dirs}; do
umount ${dir}
done
# unmap
rbd unmap /dev/${device}
# Make sure unmap success, or we will unmap by another way
unmapFinished=`rbd showmapped | grep " /dev/${device} "`
if [ -n "$unmapFinished" ]; then
unmapByAnotherWay ${device}
fi
echo "csi-rbd-anti-brain-split-success"
else
echo "csi-rbd no device found"
fi
8.批量删除ci
kubectl get ci -n test-ns | grep xxx | awk '{print $1}' | xargs kubectl patch -n test-ns com --type merge --patch-file patch.yaml
patch.yaml
metadata:
finalizers:
以上纯属个人经验分享,一起交流学习!