侧边栏壁纸
博主头像
张种恩的技术小栈博主等级

行动起来,活在当下

  • 累计撰写 748 篇文章
  • 累计创建 65 个标签
  • 累计收到 39 条评论

目 录CONTENT

文章目录

实用命令

zze
zze
2021-01-13 / 0 评论 / 1604 阅读 / 2811 字
  • 不重启扫描硬盘
for dirname in `ls /sys/class/scsi_device/`; do echo 1 > /sys/class/scsi_device/$dirname/device/rescan ; done
for dirname in `ls /sys/class/scsi_host/`;do echo "- - -" > /sys/class/scsi_host/$dirname/scan; done
  • git 设置代理
git config --global http.proxy http://172.18.80.222:41091
git config --global https.proxy http://172.18.80.222:41091
git config --global --unset http.proxy
git config --global --unset https.proxy
  • git 记住密码
git config --global credential.helper store
  • Ubuntu apt 设置代理
echo 'Acquire::http::Proxy "http://172.18.80.222:41091";' > /etc/apt/apt.conf.d/10proxy
  • Linux 虚拟机使用代理
export http_proxy="http://172.18.80.222:41091"
export https_proxy="http://172.18.80.222:41091"
  • Ubuntu 快速安装 GlusterFS
add-apt-repository ppa:gluster/glusterfs-6
apt install glusterfs-client glusterfs-server -y
  • 清理 Ceph 盘
dmsetup ls
dmsetup remove ceph-**
  • 快速生成证书
openssl genrsa -out tls.key 2048
openssl req -new -x509 -key tls.key -out tls.cert -days 360 -subj /CN=www.zze.com
  • kubectl 设置命令补全
apt install bash-completion -y
kubectl completion bash > /usr/share/bash-completion/completions/kubectl \
&& . /usr/share/bash-completion/completions/kubectl
  • 一键安装 Docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
  • k8s 为制定命名空间设置默认的拉取镜像密钥
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "<secret-name>"}]}'
  • 用环境变量替换模板中的占位符
$ cat test.tpl 
name: ${name}
age: ${age}
$ name=zze age=24 envsubst < test.tpl 
name: zze
age: 24
  • 查看 k8s 集群相关信息
# 查看所有节点上已有的污点
$ kubectl describe nodes  | grep -oPz 'Taints.*?(.|\n)*?Unschedulable|Name:.*' | grep Unschedulable -v
# 查看所有节点上已有的标签
$ kubectl describe nodes  | grep -oPz 'Lab.*?(.|\n)*?Annotations|Name:.*' | grep Annotations -v
  • git 记住密码
git config --global credential.helper store
git credential-store store

评论区