咕噜猫小站

do it, do it right, do it right now

0%

Kubernetes 配置 NFS StorageClass

前置条件:

1. 安装 nfs-client-provisioner

1
helm install nfs-provisioner stable/nfs-client-provisioner --set nfs.server=192.168.1.100 --set nfs.path=/nfs/your_path

2. 配置为默认的 StorageClass

当 pvc 没有指定 StorageClass 时,使用该 nfs 作为默认存储

设置为默认 StorageClass

1
2
# 设置 default class 为 true 。 其中 nfs-client 为上一步创建的 nfs storageclass 的名称。
kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

解除指定默认 StorageClass

Kubernetes 安装 rook ceph

本文以 Debian 10 , kubernetes 1.19 为例。 kubernetes 安装参考站内另一篇文章 Kubernetes 安装

参考资料:

由于实验环境中没有足够的空闲磁盘空间,最终实验未完成。这里仅记录前面的实验步骤,作为备忘笔记,最终过程待补充。

kubernetes RBAC 鉴权简单介绍

本文内容截取自官方文档,用于备忘与快速理解,完整信息请参考官方文档。

参考资料:

1. 简介

基于角色(Role)的访问控制(RBAC)是一种基于企业中用户的角色来调节控制对计算机或网络资源的访问方法。

tmux 常用命令一览

一、 session 相关

1. 创建新的 session

1
2
3
4
# 直接运行 tmux ,不指定 session 名字 ,session 名字将会以数字命名,从 0 开始自动递增。
tmux
# 创建特定名字的 session
tmux new -s <name>

2. 从 session 中脱离 (session 仍会在后台运行)

Linux 新系统安装配置清单

主要以 debian 系统为示例

一、 bash 配置

/root/.bashrc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
PS1='\n${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h \a\]$PS1"
    ;;
*)
    ;;
esac

export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -lh'

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

二、 公共组件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 备份原来的 sources.list
DATE_TIME_NOW=`date +"%Y%m%d_%H%M"`
mv /etc/apt/sources.list /etc/apt/sources.list.bak_${DATE_TIME_NOW}

# 设置 sources.list ,使用清华的镜像源
cat << \EOF > /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
EOF

# libsm6, libxrender1 for opencv
apt install -y \
  curl \
  gnupg2 \
  vim \
  python3-pip \
  libsm6 \
  libxrender1 \
  tmux \
  nfs-common \
  zip \
  unzip

# vim 设置,写到 vimrc.local 中,避免更新时冲突。
cat << \EOF > /etc/vim/vimrc.local
# 显示行号
set nu

# 设置 yaml 文件缩进
autocmd FileType yaml,yml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=<:>

EOF

三、 私有证书集成

1
2
cp ./my_ca.crt /usr/local/share/ca-certificates/
update-ca-certificates

四、 python 环境

1. pip 私服

Mysql 踩坑及优化笔记

Q: server has gone away

排查方向:

  1. 查看 server 端的 wait_timeout
1
mysql> show global variables like '%timeout%';
  1. client 端使用连接池,并把连接池的超时检测值设置为小于 wait_timeout 的值。

Q: 使用了 order by limit 语句导致查询慢

排查方向:

acme.sh 使用备注

官方网站: https://github.com/acmesh-official/acme.sh

1. 使用 aliyun 直接注册证书

使用 ecc 算法

1
2
3
4
export Ali_Key=""
export Ali_Secret=""

acme.sh --issue -d example.com --keylength ec-256 --dns dns_ali

2. 使用别名方式注册证书

使用 ecc 算法

1
2
3
4
export Ali_Key=""
export Ali_Secret=""

acme.sh --issue -d example.com --keylength ec-256 --dns dns_ali --challenge-alias example2.com

3. 安装到 nginx

1
2
3
4
acme.sh --install-cert --ecc -d example.com \
  --key-file       /path/to/keyfile/in/nginx/key.pem  \
  --fullchain-file /path/to/fullchain/nginx/cert.pem \
  --reloadcmd      "service nginx force-reload"

4. 删除证书

1
acme.sh --remove --ecc -d example.com