sshd
每次开机之后,启动sshd操作如下
mkdir /run/sshd
/usr/sbin/sshd
下载安装docker
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.6.tgz
tar xf docker-20.10.6.tgz
chown -R root.root docker
cp docker/* /usr/bin/
groupadd docker
mkdir /var/lib/docker /etc/docker
配置文件
vim /etc/docker/daemon.json
{
"storage-driver": "overlay2",
"registry-mirrors": ["https://q2gr04ke.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"],
"live-restore": true
}
启动dockerd
/usr/bin/dockerd
启动dockerd报错:
failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add return rule in DOCKER-ISOLATION-STAGE-1 chain: (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1
(exit status 4))
解决:
切换到legacy iptables:如果你的系统使用的是nftables作为默认的防火墙管理工具,Docker可能会因为与iptables的兼容性问题
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
最后启动dockerd
nohup /usr/bin/dockerd &
上传docker命令补全脚本并source
source /usr/share/bash-completion/completions/docker
安装kubectl
apt update && apt install -y apt-transport-https curl
curl -fsSL https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
apt update
apt install -y kubectl
也可以下载二进制kubectl
curl -LO "https://cdn.dl.k8s.io/release/v1.20.3/bin/linux/amd64/kubectl"
#kubectl自动补全
echo "source <(kubectl completion bash)" >> /etc/profile
安装helm
curl https://baltocdn.com/helm/signing.asc | sudo gpg --dearmor -o /usr/share/keyrings/helm-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/helm-archive-keyring.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
helm version
#helm自动补全
echo "source <(helm completion bash)" >> /etc/profile