helm安装脚本

#/bin/bash

# helm 安装2.14.1版本helm
cd /root/

cat <<EOF >rbac-config.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system
EOF

wget http://cmcc-public.oss-cn-hangzhou.aliyuncs.com/sysadm/helm-v2.14.1-linux-amd64.tar.gz
tar zxvf helm-v2.14.1-linux-amd64.tar.gz

chmod 755 linux-amd64/helm
chmod 755 linux-amd64/tiller
rm -f /usr/local/bin/helm /usr/local/bin/tiller
mv linux-amd64/helm /usr/local/bin/
mv linux-amd64/tiller /usr/local/bin/

kubectl create -f rbac-config.yaml
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
kubectl get po -n kube-system | grep tiller
helm version
rm -rf linux-amd64 helm-v2.14.1-linux-amd64.tar.gz rbac-config.yaml

Gpu安装和卸载

# 安装
sshpass -p'abc' ssh -o StrictHostKeyChecking=no  root@$i ' echo -e "n\n" | sh /root/NVIDIA-Linux-x86_64-418.67.run --ui=none && docker run  --rm nvidia/cuda:9.0-base nvidia-smi'
# 卸载
#!/bin/bash

for i in $(cat gpu_ip.txt)
do
        echo "=============="$i"==============="
        

        ##check current gpu-version

        sshpass -p'abc' ssh -o StrictHostKeyChecking=no root@$i 'nvidia-smi'

        sshpass -p'abc' ssh -o StrictHostKeyChecking=no root@$i 'mkdir -p /home/admin/auth'

        ##copy nvidia run file to server
        sshpass -p'abc' scp -o StrictHostKeyChecking=no *.run root@$i:~/

        ##uninstall older version
        sshpass -p'abc' ssh -o StrictHostKeyChecking=no  root@$i 'sh /root/NVIDIA-Linux-x86_64-410.79.run --uninstall -s && reboot'
done

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐