系统相关
首页 > 系统相关> > linux下docker按照

linux下docker按照

作者:互联网

  安装docker环境 一 docker 安装 1 使用yum安装(root环境执行) yum install docker   2 重启docker服务(root环境执行) systemctl restart docker   3 添加权限允许在 wgame用户下执行docker命令(root环境执行) groupdadd docker usermod -a -G docker wgame   二 docker使用登陆方式创建私有仓库(必须支持https,自己搭出来比较麻烦,放弃) 1 创建认证用户和密码 docker run --entrypoint htpasswd registry:2.6.2 -Bbn lilith Lilith_107 > ./auth/htpasswd 2 启动registry容器仓库 docker run -d -p 5000:5000 --restart=always --name registry -v `pwd`/auth:/auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry   Docker自从1.3.X之后docker registry交互默认使用的是HTTPS,但是搭建私有镜像默认使用的是HTTP服务,所以与私有镜像交时出现以上错误。       二 master安装k8s环境(不一定好用) 1 master机器安装etcd和kubernetes-master yum install -y epel-release yum install -y etcd kubernetes-master yum install -y flannel   2 配置/etc/kubernetes/apiserver 文件 主要把127,0.0.1的IP改成0.0.0.0   3 设置开机启动 etcd,kube-apiserver,kube-controller-manager, kube-scheduler for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES ; done systemctl restart etcd systemctl enable etcd systemctl status etcd   3 验证etcd运行状态 etcdctl -C http://etcd:2379 cluster-health   4 在etcd中定义flannel网络 etcdctl mk /atomic.io/network/config '{"Network":"172.17.0.0/16"}'   5 检查 kubectl get cs   三 node机器安装k8s 1 node机器上安装kebernets和flannel yum install -y epel-release yum -y install flannel kubernetes-node 2 为flannel网络指定etcd服务,修改 /etc/sysconfig/flanneld 文件,把FLANNEL_ETCD_ENDPOINTS配置设置成master机器的IP FLANNEL_ETCD_ENDPOINTS="http://****:2379" 3 修改/etc/kubernetes/config文件,设置KUBE_MASTER为master的IP KUBE_MASTER="--master=http://*****:8080" 4 启动 kube-proxy,kubelet,docker,flanneld for SERVICES in kube-proxy kubelet docker flanneld;do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES; done

标签:systemctl,yum,etcd,linux,SERVICES,docker,kube,按照
来源: https://www.cnblogs.com/doudou1024/p/16411860.html