rancher docker运行,国内环境
docker run -d --privileged --name rancher --restart=unless-stopped -p 38086:80 -p 32443:443 \
-e CATTLE_SYSTEM_DEFAULT_REGISTRY=registry.cn-hangzhou.aliyuncs.com \
-e CATTLE_BOOTSTRAP_PASSWORD=admin \
-v /data/rancher-server/rancher/:/var/lib/rancher \
-v /data/rancher-server/auditlog/:/var/log/auditlog \
--name rancher rancher/rancher:v2.6.3
忘记登录密码
docker exec -it <container_id> reset-password
删除
sudo docker rm -f $(sudo docker ps -qa)
sudo rm -rf /var/etcd
for m in $(sudo tac /proc/mounts | sudo awk ‘{print $2}’|sudo grep /var/lib/kubelet);do
sudo umount $m||true
done
sudo rm -rf /var/lib/kubelet/
for m in $(sudo tac /proc/mounts | sudo awk ‘{print $2}’|sudo grep /var/lib/rancher);do
sudo umount $m||true
done
umount $(mount | grep kubelet | awk '{print $3}')
docker system prune -f
docker volume rm $(docker volume ls -q)
docker rm -f $(docker ps -a -q)
rm -rf /etc/ceph \
/etc/cni \
/etc/kubernetes \
/opt/cni \
/opt/rke \
/run/secrets/kubernetes.io \
/run/calico \
/run/flannel \
/var/lib/calico \
/var/lib/etcd \
/var/lib/cni \
/var/lib/kubelet \
/var/lib/rancher/rke/log \
/var/log/containers \
/var/log/pods \
/var/run/calico
如果使用NFS 存储:
api-server 需要添加下面参数
- --feature-gates=RemoveSelfLink=false # 添加这个配置
对于RKE的集群使用
rancher_kubernetes_engine_config:
services:
kube-api:
extra_args:
feature-gates: 'RemoveSelfLink=false'