安装 nvidia-docker k8s and rancher

Docker:


About Version

Docker CE 在 17.03 版本之前叫 Docker Engine, 版本说明参考这里 =>Docker Engine release notes, 可以看到 Docker Engine 的版本号范围:0.1.0 ~ 1.13.1

install doc :  https://docs.docker.com/install/linux/docker-ce/centos/

1. sudo yum-config-manager --add-repo  https://download.docker.com/linux/centos/docker-ce.repo

2. yum list docker-ce--showduplicates| sort-r

3. sudo yum install docker-ce-18.06.3.ce-3.el7 docker-ce-cli-18.06.3.ce-3.el7 containerd.io

4. sudo systemctl start docker

5. sudo docker run hello-world


Nvidia Docker:


install doc: https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)

1. sudo curl -s -L https://nvidia.github.io/nvidia-docker/centos7/x86_64/nvidia-docker.repo | sudo tee /etc/yum.repos.d/nvidia-docker.repo

2. sudo yum install nvidia-docker2

3. sudo pkill -SIGHUP dockerd

4. sudo vi /etc/docker/daemon.json

{ "default-runtime":"nvidia", "runtimes": { "nvidia": { "path": "nvidia-container-runtime", "runtimeArgs": [] } }}

5. sudo systemctl restart docker


Rancher:


1. 关闭selinux: sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

2. 关闭防火墙: systemctl stop firewalld.service && systemctl disable firewalld.service

3. 修改时区: ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

4. 修改系统语言环境: sudo echo 'LANG="en_US.UTF-8"' >> /etc/profile;source /etc/profile

5. 配置主机NTP时间同步

6. 配置Docker存储驱动

/etc/docker/daemon.json:

{

    "default-runtime":"nvidia",

    "runtimes": {

        "nvidia": {

            "path": "nvidia-container-runtime",

            "runtimeArgs": []

        }

    },

    "registry-mirrors": ["https://ls7ql79w.mirror.aliyuncs.com"],

    "storage-driver": "overlay2",

    "storage-opts": ["overlay2.override_kernel_check=true"],

    "log-driver": "json-file",

    "log-opts": {

        "max-size": "100m",

        "max-file": "3"

    }

}


7. docker pull rancher/rancher:stable

8. docker run -d --restart=unless-stopped -p 8080:80 -p 443:443 -v /var/lib/rancher/ -v /data/app/rancher/var/log/auditlog:/var/log/auditlog -e AUDIT_LEVEL=3 rancher/rancher:stable --no-cacerts


kubectl install


1. download in https://mirrors.ustc.edu.cn/kubernetes/apt/pool/

wget https://mirrors.ustc.edu.cn/kubernetes/apt/pool/kubectl_1.12.7-00_amd64_00dbe2b6f91b1b8beffb1731ca77d5b37efbaebd20f8ef2eb1837bbd4370092c.deb

2. unpackage use : ar -vx kubectl_1.12.7-00_amd64.deb

3. find kubctl, copy to /usr/bin

4. config ~/.kube/config


Helm install


1. wget https://get.helm.sh/helm-v2.14.1-linux-amd64.tar.gz

2. tar xvf helm-v2.14.1-linux-amd64.tar.gz

3. cp linux-amd64/helm /usr/bin

4. yum install -y socat  # execute on all cluster node

5. helm init --client-only --stable-repo-url https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts/

6. helm repo add incubator https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator/

7. helm repo update

8. helm init --service-account tiller --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.1 --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts

9. helm init --service-account tiller --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.1 --tiller-tls-cert /etc/kubernetes/ssl/tiller001.pem --tiller-tls-key /etc/kubernetes/ssl/tiller001-key.pem --tls-ca-cert /etc/kubernetes/ssl/ca.pem --tiller-namespace kube-system --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts

10. kubectlcreateserviceaccount--namespace kube-system tiller

11. kubectlcreateclusterrolebinding tiller-cluster-rule--clusterrole=cluster-admin --serviceaccount=kube-system:tiller

12. kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

13. kubectl get deploy --namespace kube-systemtiller-deploy  --output yaml|grepserviceAccount

14. helm version

Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}

Server: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}


NFS install


1. yum-yinstallnfs-utils

2. vi /etc/exports

/data/app/rancher/nfs    *(rw,sync,fsid=0)

3. systemctl start rpcbind.service

4. systemctl enable rpcbind.service

5. systemctl start nfs.service

6. systemctl enable nfs.service

你可能感兴趣的:(安装 nvidia-docker k8s and rancher)