Configure Node
This is assuming that the box is already imaged
Create affinity rules for new nodes
Become root
sudo su -RUN THESE COMMAND IF YOU HAVE SPACE IN THE LOGICAL VOLUME (Go to #4 otherwise)
Extend 80GB to /var/ and 10G to /var/log/lvextend -L +10G /dev/vg1/lv_var_logxfs_growfs /dev/vg1/lv_var_loglvextend -L +80G /dev/vg1/lv_varxfs_growfs /dev/vg1/lv_varAdd a 80GB HDD (Thick Provision Eager Zeroed) to the VM and extend 70GB to /var/ and 10G to /var/log/
#Run the command belowifdisk doesn't show up in lsblkforx in012;doecho"- - -"> /sys/class/scsi_host/host${x}/scan; donefind /sys/class/scsi_device/ -mindepth1-maxdepth1|whileread f;doecho1>"${f}/device/rescan"; done#Change the nameifnecessaryparted /dev/sdb#run the below in (parted)mklabel gptmkpart primary 2048s -1quit#Extend sharepvcreate /dev/sdb1 && vgextend vg1 /dev/sdb1 && lvextend -L +10G /dev/vg1/lv_var_log && xfs_growfs /dev/vg1/lv_var_log && lvextend -l +100%FREE /dev/vg1/lv_var && xfs_growfs /dev/vg1/lv_varPermit Root login without password and add Bootstrap node SSH to allowed key list
sed -i's/PermitRootLogin.*/PermitRootLogin without-password/g'/etc/ssh/sshd_configsystemctl restart sshdmkdir .ssh && chmod700.ssh && touch .ssh/authorized_keys && chmod600.ssh/authorized_keysecho <serverAbcs1 ssh_key> > .ssh/authorized_keysRun YUM update to prevent docker headaches later on
yum update -yRest of the configuration
#install python libraryyum install -y pyOpenSSL python-rhsm-certificates jq python-configparser rng-tools python2-passlib#remove immutable flag so docker can usethischattr -i /etc/resolv.conf#OpenShift plays with DNS resolution sothisis just to preventlongwaits when troubleshooting issuessed -i's/^#\(UseDNS\).*$/\1 no/g'/etc/ssh/sshd_config && systemctl restart sshd#This was a security lockdown feature, but ends up scanning the docker containers and messing with them, causing them tobreak/bin/rm -f /etc/cron.daily/unowned_files#Requiredfordnsmasq servicesystemctl enable NetworkManager && systemctl start NetworkManager#Make sure that running lots of pods doesn't cause us to run out of entropy on the hostssystemctl enable rngd && systemctl start rngdCUDAML Specific: Create NIC bonding
cat > /etc/sysconfig/network-scripts/ifcfg-bond0 << EOFDEVICE=bond0TYPE=BondNAME=bond0BONDING_MASTER=yesBOOTPROTO=noneONBOOT="yes"IPV6INIT="no"NM_CONTROLLED=noBONDING_OPTS="mode=4 miimon=100 lacp_rate=1"EOFegrep IPADDR /etc/sysconfig/network-scripts/ifcfg-em1 >> /etc/sysconfig/network-scripts/ifcfg-bond0egrep GATEWAY /etc/sysconfig/network-scripts/ifcfg-em1 >> /etc/sysconfig/network-scripts/ifcfg-bond0egrep NETMASK /etc/sysconfig/network-scripts/ifcfg-em1 >> /etc/sysconfig/network-scripts/ifcfg-bond0echo'ZONE=public'>> /etc/sysconfig/network-scripts/ifcfg-bond0cat > /etc/sysconfig/network-scripts/ifcfg-em1 << EOFNAME=em1DEVICE=em1BOOTPROTO=noneONBOOT=yesNM_CONTROLLED=noIPV6INIT=noMASTER=bond0SLAVE=yesEOFcat > /etc/sysconfig/network-scripts/ifcfg-em2 << EOFNAME=em2DEVICE=em2BOOTPROTO=noneONBOOT=yesNM_CONTROLLED=noIPV6INIT=noMASTER=bond0SLAVE=yesEOFcat > /etc/sysconfig/network-scripts/ifcfg-bond0.160<< EOFbond0.160DEVICE=bond0.160NAME=bond0.160BOOTPROTO=noneIPADDR="10.17.160.148"NETMASK="255.255.252.0"ONBOOT="yes"VLAN=yesIPV6INIT="no"NM_CONTROLLED=noZONE=publicEOFmodprobe --first-time 8021qsystemctl restart network
Add Node to OpenShift Cluster
SSH to the Openshift Bootstrap server and become root
ssh serverAbcs01.xyz.domainsudo su -Navigate to the ansible folder and edit the host file
cd ~/ansiblevi hosts-3.11Add the new host FQDN along with the node type under [new_nodes]
Run the scale up Ansible Playbook
ansible-playbook -i hosts-3.11~/openshift-ansible-3.11/playbooks/openshift-node/scaleup.ymlSSH to a Master node and verify that the nodes were added
ssh serverAbcm01.xyz.domainsudo su -oc get nodesOptional: If the nodes were added, but shows up as "Not Ready", and "oc describe node <node_name" return "Error 'NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized'"
cat > /etc/origin/node/resolv.conf <<EOFnameserver192.168.20.10EOFcat > /etc/dnsmasq.d/origin-upstream-dns.conf << EOFserver=192.168.20.10EOF#CUDAML BOX ONLYcat > /etc/resolv.conf << EOFdomain xyz.domainsearch cluster.local xyz.domain org11.netnameserver <change me -- server IPSet the new node as unschedulable
oc adm manage-node <node-name> --schedulable=falseSSH to the node that were created. Downgrade docker (if needed to MATCH the version on the master nodes) on the node and reboot
Notice
MATCH the docker version to the Master nodes!
Previous versions we used have a bug that causes PLEG to become unhealthy and mark pods as unknown:
docker-1.13.1-91.git07f3374.el7.centos.x86_64
docker-common-1.13.1-91.git07f3374.el7.centos.x86_64
docker-client-1.13.1-91.git07f3374.el7.centos.x86_64
systemctl stop origin-nodesystemctl stop dockersudo yum downgrade -y docker-1.13.1-109.gitcccb291.el7.centos.x86_64 docker-common-1.13.1-109.gitcccb291.el7.centos.x86_64 docker-client-1.13.1-109.gitcccb291.el7.centos.x86_64sudo reboot
Compute Node Specific Configuration
The steps below are only for OpenShift Compute Node.
- Perform these steps on the Bootstrap node
- Run oc login -u duc.le os.org11inc.xyz to login to the cluster
- Make sure to change the hostnames in these scripts first
These scripts should already exists in /root/ansible/shiftn-setup (See serverAbcS01) - Create the directory and add these scripts in other wise
1-configure-for-cifs.sh Collapse source#!/bin/bashKUBE_PLUG_DIR="/usr/libexec/kubernetes/kubelet-plugins/volume/exec/fstab~cifs"forxin`seq9 9`;doforyinm n i;doif["${x}"-gt"3"] && ["${y}"!="n"];thencontinue;fi;sshPUNV-shift${y}0${x}"yum clean all; yum install -y cifs-utils; mkdir -p ${KUBE_PLUG_DIR};";cat- <<"EOF"|sshPUNV-shift${y}0${x}"cat > ${KUBE_PLUG_DIR}/cifs"#!/bin/bashset-u# ====================================================================# Example configuration:# ====================================================================# --------------------------------------------------------------------# secret.yml:# --------------------------------------------------------------------# apiVersion: v1# kind: Secret# metadata:# name: cifs-secret# namespace: default# type: fstab/cifs# data:# username: 'ZXhhbXBsZQo='# password: 'c2VjcmV0Cg=='# domain: 'ZG9tYWluCg=='## --------------------------------------------------------------------# pod.yml:# --------------------------------------------------------------------# apiVersion: v1# kind: Pod# metadata:# name: busybox# namespace: default# spec:# containers:# - name: busybox# image: busybox# command:# - sleep# - "3600"# imagePullPolicy: IfNotPresent# volumeMounts:# - name: test# mountPath: /data# volumes:# - name: test# flexVolume:# driver: "fstab/cifs"# fsType: "cifs"# secretRef:# name: "cifs-secret"# options:# networkPath: "//example-server/backup"# mountOptions: "dir_mode=0755,file_mode=0644,noperm"# --------------------------------------------------------------------# Uncomment the following lines to see how this plugin is called:echo>>/tmp/cifs.logdate>>/tmp/cifs.logecho"$@">>/tmp/cifs.loginit() {assertBinaryInstalledmount.cifs cifs-utilsassertBinaryInstalled jq jqassertBinaryInstalled mountpoint util-linuxassertBinaryInstalled base64 coreutilsecho'{ "status": "Success", "message": "The fstab/cifs flexvolume plugin was initialized successfully", "capabilities": { "attach": false, "selinuxRelabel": false, "fsGroup": false } }'exit0}assertBinaryInstalled() {binary="$1"package="$2"if!which"$binary">/dev/null;thenerrorExit"Failed to initialize the fstab/cifs flexvolume plugin. $binary command not found. Please install the $package package."fi}errorExit() {if[[ $# -ne 1 ]] ; thenecho'{ "status": "Failure", "message": "Unknown error in the fstab/cifs flexvolume plugin." }'elsejq -Mcn --arg message"$1"'{ "status": "Failure", "message": $message }'fiexit1}doMount() {if[[ -z ${1:-} || -z ${2:-} ]] ;thenerrorExit"cifs mount: syntax error. usage: cifs mount <mount dir> <json options>"fimountPoint="$1"shiftjson=$(printf'%s '"${@}")if! jq -e . >/dev/null2>&1 <<<"$json";thenerrorExit"cifs mount: syntax error. invalid json: '$json'"finetworkPath="$(jq --raw-output -e '.networkPath' <<< "$json" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: option networkPath missing in flexvolume configuration."fimountOptions="$(jq --raw-output -e '.mountOptions' <<< "$json" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: option mountOptions missing in flexvolume configuration."fifsGroup="$(jq --raw-output -e '.["kubernetes.io/fsGroup"]' <<< "$json" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: fsGroup not found."ficifsUsernameBase64="$(jq --raw-output -e '.["kubernetes.io/secret/username"]' <<< "$json" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: username not found. the flexVolume definition must contain a secretRef to a secret with username, password, and domain."ficifsPasswordBase64="$(jq --raw-output -e '.["kubernetes.io/secret/password"]' <<< "$json" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: password not found. the flexVolume definition must contain a secretRef to a secret with username, password, and domain."ficifsDomainBase64="$(jq --raw-output -e '.["kubernetes.io/secret/domain"]' <<< "$json" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: domain not found. the flexVolume definition must contain a secretRef to a secret with username, password, and domain."ficifsUsername="$(base64 --decode <<< "$cifsUsernameBase64" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: username secret is not base64 encoded."ficifsPassword="$(base64 --decode <<< "$cifsPasswordBase64" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: password secret is not base64 encoded."ficifsDomain="$(base64 --decode <<< "$cifsDomainBase64" 2>/dev/null)"if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: domain secret is not base64 encoded."fiif!mkdir-p"$mountPoint">/dev/null2>&1 ;thenerrorExit"cifs mount: failed to create mount directory: '$mountPoint'"fiif[[ $(mountpoint"$mountPoint") = *"is a mountpoint"* ]] ;thenerrorExit"cifs mount: there is already a filesystem mounted under the mount directory: '$mountPoint'"fiif[[ ! -z $(ls-A"$mountPoint"2>/dev/null) ]] ;thenerrorExit"cifs mount: mount directory is not an empty directory: '$mountPoint'"firesult=$(mount-t cifs"$networkPath""$mountPoint"-o"uid=$fsGroup,gid=$fsGroup,username=$cifsUsername,password=$cifsPassword,domain=$cifsDomain,context=system_u:object_r:container_file_t:s0,$mountOptions"2>&1)if[[ $? -ne0 ]] ;thenerrorExit"cifs mount: failed to mount the network path: $result"fiecho'{ "status": "Success" }'exit0}doUnmount() {if[[ -z ${1:-} ]] ;thenerrorExit"cifs unmount: syntax error. usage: cifs unmount <mount dir>"fimountPoint="$1"if[[ $(mountpoint"$mountPoint") != *"is a mountpoint"* ]] ;thenerrorExit"cifs unmount: no filesystem mounted under directory: '$mountPoint'"firesult=$(umount"$mountPoint"2>&1)if[[ $? -ne0 ]] ;thenerrorExit"cifs unmount: failed to unmount the network path: $result"fiecho'{ "status": "Success" }'exit0}not_supported() {echo'{ "status": "Not supported" }'exit1}command=${1:-}if[[ -n $command]];thenshiftficase"$command"ininit)init"$@";;mount)doMount"$@";;unmount)doUnmount"$@";;*)not_supported"$@";;esacEOFsshPUNV-shift${y}0${x}"chmod 755 ${KUBE_PLUG_DIR}/cifs;";done;done;2-configure-cifs-for-shiftn-only.sh Collapse sourceforxin`seq-w 9 16`;doecho"Copying SELinux module definition to server ..."cat- <<"EOF"|ssh-q serverAbcn${x}"cat > ${HOME}/container_access_cifs.te"module container_access_cifs 1.0;require {typecifs_t;typecontainer_t;class filesystemmount;classfile{ ioctlreadwrite create getattr setattr lock append unlink link renameopen};classdir{ ioctlreadwrite create getattr setattr lock unlink link rename add_name remove_name reparent searchrmdiropen};}#============= container_t ==============allow container_t cifs_t:filesystemmount;allow container_t cifs_t:file{ ioctlreadwrite create getattr setattr lock append unlink link renameopen};allow container_t cifs_t:dir{ ioctlreadwrite create getattr setattr lock unlink link rename add_name remove_name reparent searchrmdiropen};EOFecho"Compiling SELinux module definition ..."ssh-q serverAbcn${x}"checkmodule -M -m -o container_access_cifs.mod container_access_cifs.te && semodule_package -o container_access_cifs.pp -m container_access_cifs.mod && semodule -i container_access_cifs.pp;";done;3-configure-for-trident.sh Collapse source#!/bin/bashforxin`seq9 9`;doforyinm n i;doif["${x}"-gt"3"] && ["${y}"!="n"];thencontinue;fi;sshPUNV-shift${y}0${x}"yum install -y sg3_utils";#ssh -t serverAbc${y}${x} "systemctl status iscsi";ssh-t PUNV-shift${y}0${x}"systemctl restart iscsi";done;done;4-configure-docker-image-cleanup.sh Collapse source#!/bin/bashCRON_FILE="/etc/cron.weekly/docker-image-cleanup.sh"forxin`seq9 9`;doforyinn i;doif["${x}"-gt"3"] && ["${y}"!="n"];thencontinue;fi;ssh-q PUNV-shift${y}0${x}"touch ${CRON_FILE}; chmod 755 ${CRON_FILE};";cat- <<"EOF"|ssh-q PUNV-shift${y}${x}"cat > ${CRON_FILE}"#!/bin/shdocker image prune -afEOFdone;done;5-configure-nodes-for-httpd-proxying.sh Collapse source#!/bin/bashforxin`seq9 9`;do#ssh serverAbcn0${x} "/usr/sbin/getsebool httpd_can_network_connect";sshserverAbcn0${x}"/usr/sbin/setsebool -P httpd_can_network_connect 1";done;6-configure-docker-registries.sh Collapse source#!/bin/bashorgA_DIR="/etc/docker/certs.d/orgA-docker.xyz.domain:5000"LOCAL_DIR="/etc/docker/certs.d/docker-registry.default.svc:5000"forxin`seq9 9`;doforyinm n i;doif["${x}"-gt"3"] && ["${y}"!="n"];thencontinue;fi;sshPUNV-shift${y}0${x}"mkdir -p ${orgA_DIR}; mkdir -p ${LOCAL_DIR};";sshPUNV-shift${y}0${x}"ln -sf /etc/pki/ca-trust/source/anchors/hqi1v-opsica01-2017.crt ${orgA_DIR}/;";sshPUNV-shift${y}0${x}"ln -sf /etc/origin/node/client-ca.crt ${LOCAL_DIR}/;";done;done;7-fix-docker-log-rotation.sh Collapse source#!/bin/bashforxin`seq14 16`;doforyinm n i;doif["${x}"-gt"3"] && ["${y}"!="n"];thencontinue;fi;sshPUNV-shift${y}${x}"echo -e '{\n \"log-driver\": \"json-file\",\n \"log-opts\": {\"max-size\": \"50m\", \"max-file\": \"3\"}\n}' > /etc/docker/daemon.json; systemctl restart docker;";done;done;8-label-all-nodes-for-filebeat.sh Collapse source#!/bin/bashforxin`seq1 8`;doforyinm n i;doif["${x}"-gt"3"] && ["${y}"!="n"];thencontinue;fi;oc label node PUNV-shift${y}0${x}.xyz.domain logging-infra-filebeat=true;done;done;9-label-compute-nodes-as-normal.sh Collapse source#!/bin/bashforxin`seq1 8`;dooc label node serverAbcn0${x}.xyz.domain orgA-compute=normal;done;- SSH to the new node and Reboot it
SSH to the Master node and make the new node schedulable
oc adm manage-node <node_name> --schedulable=true
CUDA Node (Machine Learning) Specific Configuration
The steps below are only for OpenShift CUDA compute node.
SSH to an Openshift master node and add labels + assign node permission to machine learning team
#Add labeloc edit node serverxyzl07.xyz.domain -o yamllabels:....logging-infra-filebeat:"true"orgA-compute: gpuopenshift.com/gpu-accelerator:"true"tfserving:"true"#Addnewcuda node under"resourceNames"so the Machine Learning team can manage itoc edit clusterrole machinelearning-view-nodesSSH to a host with perl installed (or run yum install perl) and run the perl script below
#Create a perl script to generate iqnforiscsi connectionvi iqn.pl:set paste#!/usr/bin/perl# Generate a sample IQNforthe hostname$|=1;use strict;$ARGV[0] || die"Usage: $0 hostname\n";;my $hostname = $ARGV[0];#sample: iqn.1994-05.com.redhat:86a2b96edeccmy@chars= ('0'..'9','a'..'f');my $len =12;my $string;my $hex;while($len--){ $hex .= $chars[rand@chars] };my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();$year+=1900;my $iqn ="iqn.$year-$mon.net.org11.$hostname:$hex";print $iqn,"\n";#Make the script executablechmod +x iqn.pl#run the script with the node hostname./iqn.pl XYZSERVER#thiswill generate:iqn.2020-0.net.org11.XYZSERVER7:39462cf8328bGo to the Storage Management and add iSCSI connection (We're using v5000 in Vegas, so this is https://lvp0p-v5kmva-mgmt)
Click here to expand...Add iSCSI to CUDAML node and enable iSCSI
groupadd -g1000460000-r machinelearning-containers;useradd -c"machinelearning container user"-M -r -s /sbin/nologin -u1000460000-g1000460000machinelearning-containers;# Set iSCSI initiator namecat > /etc/iscsi/initiatorname.iscsi << EOFInitiatorName=iqn.2020-0.net.org11.serverxyzl06:2114872d8665EOF# Configure CHAP secretsvim /etc/iscsi/iscsid.confnode.session.auth.authmethod = CHAPnode.session.auth.username = iqn.2020-0.net.org11.XYZSRVERl07:39462cf8328bnode.session.auth.password = <CHAP_secret_for_host>node.session.auth.password_in = <CHAP_secret_for_cluster>discovery.sendtargets.auth.authmethod = CHAPdiscovery.sendtargets.auth.username = iqn.2020-0.net.org11.XYZSERVER:39462cf8328bdiscovery.sendtargets.auth.password = <CHAP_secret_for_host>discovery.sendtargets.auth.password_in = <CHAP_secret_for_cluster># Set iSCSI session timeoutsed -i's/^\(node.session.err_timeo.abort_timeout =\).*$/\1 60/g'/etc/iscsi/iscsid.conf;# Set iSCSI session max commands in queuesed -i's/^\(node.session.cmds_max =\).*$/\1 1024/g'/etc/iscsi/iscsid.conf;# Set iSCSI session queue depthsed -i's/^\(node.session.queue_depth =\).*$/\1 128/g'/etc/iscsi/iscsid.conf;cat > /etc/udev/rules.d/99-storwize.rules <<"EOF"ACTION=="add|change", KERNEL=="sd[a-z]", ATTRS{vendor}=="IBM", ATTR{queue/scheduler}="noop", ATTR{queue/add_random}="0", ATTR{queue/rq_affinity}="2", ATTR{queue/nr_requests}="1024", ATTR{queue/max_sectors_kb}="2048", RUN+="/sbin/hdparm -Q 64 /dev/%k", RUN+="/bin/sh -c 'echo 60 > /sys/$DEVPATH/device/timeout'"EOFudevadm control --reloadudevadm trigger#ScanforiSCSI target in Vegas v5kiscsiadm -m discovery -t sendtargets -p10.17.160.31:3260iscsiadm -m discovery -t sendtargets -p10.17.160.32:3260iscsiadm -m discovery -t sendtargets -p10.17.160.33:3260iscsiadm -m discovery -t sendtargets -p10.17.160.34:3260#Add iSCSI nodeiscsiadm -m node --portal10.17.160.31:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node2 -liscsiadm -m node --portal10.17.160.33:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node2 -liscsiadm -m node --portal10.17.160.32:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node1 -liscsiadm -m node --portal10.17.160.34:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node1 -l#Set iSCSI startup to automatically connect to these nodeiscsiadm -m node --portal10.17.160.31:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node2 -o update -n node.startup -v automaticiscsiadm -m node --portal10.17.160.33:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node2 -o update -n node.startup -v automaticiscsiadm -m node --portal10.17.160.32:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node1 -o update -n node.startup -v automaticiscsiadm -m node --portal10.17.160.34:3260--target iqn.1986-03.com.ibm:2145.lvp0p-v5kmva.node1 -o update -n node.startup -v automaticiscsiadm -m nodesystemctl restart multipathdsystemctl status multipathdAdd NVIDIA Yum Repo and install NVIDIA packages
cat > /etc/yum.repos.d/nvidia.repo <<"EOF"[cuda]name=Official Nvidia CUDA YUM Repogpgcheck=1gpgkey=http://hqi1v-opspxe01.xyz.domain/public/nvidia/7/cuda/x86_64/7fa2af80.pubbaseurl=http://hqi1v-opspxe01.xyz.domain/public/nvidia/7/cuda/x86_64/latest[libnvidia-container]name=libnvidia-containergpgcheck=1gpgkey=http://hqi1v-opspxe01.xyz.domain/public/libnvidia-container/7/x86_64/gpgkeybaseurl=http://hqi1v-opspxe01.xyz.domain/public/libnvidia-container/7/x86_64/latest[nvidia-container-runtime]name=nvidia-container-runtimegpgcheck=1gpgkey=http://hqi1v-opspxe01.xyz.domain/public/nvidia-container-runtime/7/x86_64/gpgkeybaseurl=http://hqi1v-opspxe01.xyz.domain/public/nvidia-container-runtime/7/x86_64/latestEOFyum -y install kernel-devel-`uname -r`yum -y install nvidia-driver nvidia-driver-devel nvidia-driver-cuda nvidia-modprobeyum -y install nvidia-container-runtime-hook --nogpgcheckRemove default NVIDIA driver and add the NVIDIA yum-installed package driver. Verify by setting up docker container that works with this driver
#Removedefaultdrivermodprobe -r nouveau#Add NVIDIA drivernvidia-modprobe && nvidia-modprobe -u#Setup container using docker to test NVIDIA driverdocker run --privileged -it --rm docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1#Removethisimage once the previous command produce a SUCCESSdocker rmi docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1Setup SELINUX context so that any arbitrary user in docker container can use the CUDA library
#Change security contextforthisfolderchcon -t container_file_t /dev/nvidia*;#Downloadthisselinux post processed filecurl -LO https://raw.githubusercontent.com/zvonkok/origin-ci-gpu/master/selinux/nvidia-container.pp#Add to our SELINUX contextsemodule -i nvidia-container.pp#Reset SELINUX to the updated contextnvidia-container-cli -k list | restorecon -v -f -restorecon -Rv /devrestorecon -Rv /var/lib/kubelet#Test using docker image againdocker run --user1000:1000--security-opt=no-new-privileges --cap-drop=ALL --security-opt label=type:nvidia_container_t -it --rm docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1#Remove once the previous command produce a SUCCESSdocker rmi docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1Setup SELINUX context so OpenShift can R/W CIFS in CUDA Docker container and reboot after finished
cat > container_mount_cifs.te <<"EOF"module container_mount_cifs1.0;require {type cifs_t;type container_t;classfilesystem mount;}allow container_t cifs_t:filesystem mount;EOFcheckmodule -M -m -o container_mount_cifs.mod container_mount_cifs.te;semodule_package -o container_mount_cifs.pp -m container_mount_cifs.mod;semodule -i container_mount_cifs.pp;semanage fcontext --add --type container_file_t"/var/lib/origin/openshift.local.volumes/pods/[^/]+/volumes/fstab~cifs(/.*)?"cat > container_access_cifs.te <<"EOF"module container_access_cifs1.0;require {type cifs_t;type container_t;classfilesystem mount;classfile { ioctl read write create getattr setattr lock append unlink link rename open };classdir { ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir open };}allow container_t cifs_t:filesystem mount;allow container_t cifs_t:file { ioctl read write create getattr setattr lock append unlink link rename open };allow container_t cifs_t:dir { ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir open };EOFcheckmodule -M -m -o container_access_cifs.mod container_access_cifs.te;semodule_package -o container_access_cifs.pp -m container_access_cifs.mod;semodule -i container_access_cifs.pp;cat > nvidia_container_access_cifs.te <<"EOF"module nvidia_container_access_cifs1.0;require {type cifs_t;type nvidia_container_t;classfilesystem mount;classfile { ioctl read write create getattr setattr lock append unlink link rename open };classdir { ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir open };}allow nvidia_container_t cifs_t:filesystem mount;allow nvidia_container_t cifs_t:file { ioctl read write create getattr setattr lock append unlink link rename open };allow nvidia_container_t cifs_t:dir { ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir open };EOFcheckmodule -M -m -o nvidia_container_access_cifs.mod nvidia_container_access_cifs.te;semodule_package -o nvidia_container_access_cifs.pp -m nvidia_container_access_cifs.mod;semodule -i nvidia_container_access_cifs.pp;#Testdocker run --user1000:1000--security-opt=no-new-privileges --cap-drop=ALL --security-opt label=type:nvidia_container_t -it --rm docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1semanage fcontext --add --type container_file_t --ftype c"/dev/nvidia.*"sed -i's/ -Z / --context=system_u:object_r:container_file_t:s0 /g'/usr/lib/udev/rules.d/60-nvidia-uvm.rulescat >> /etc/rc.local <<"EOFEOF"/sbin/modprobe nvidia-uvmif["$?"-eq0]; thenD=`grep nvidia-uvm /proc/devices | awk'{print $1}'`mknod -m666--context=system_u:object_r:container_file_t:s0 /dev/nvidia-uvm c $D0mknod -m666--context=system_u:object_r:container_file_t:s0 /dev/nvidia-uvm-tools c $D1elseexit1fiEOFEOFrebootAdd new cudaml entry to all cudaml nodes /etc/hosts file
[root@XYZ~]# cat /etc/hosts127.0.0.1localhost localhost.localdomain localhost4 localhost4.localdomain4::1localhost localhost.localdomain localhost6 localhost6.localdomain610.17.148.141serverxyzl01.xyz.domain10.17.148.142serverxyzl02.xyz.domain10.17.148.143serverxyzl03.xyz.domain10.17.148.144serverxyzl04.xyz.domain10.17.148.146serverxyzl05.xyz.domain10.17.148.147serverxyzl06.xyz.domain10.17.148.148serverxyzl07.xyz.domain10.17.148.149serverxyzl08.xyz.domainSetup PCS clustering
#install pre-reqyum install -y pcs lvm2-cluster gfs2-utils fence-agents-scsi#Open firewall on old nodesfortcpport in22243121540321064;dofwAddSrcIpPortProto10.17.148.149${tcpport} tcp; done;forudpport in54045405;dofwAddSrcIpPortProto10.17.148.149${udpport} udp; done;#Open firewall onnewnodesforsvr in `seq141144`;dofortcpport in22243121540321064;dofwAddSrcIpPortProto10.17.148.${svr} ${tcpport} tcp; done;forudpport in54045405;dofwAddSrcIpPortProto10.17.148.${svr} ${udpport} udp; done; done;forsvr in `seq146149`;dofortcpport in22243121540321064;dofwAddSrcIpPortProto10.17.148.${svr} ${tcpport} tcp; done;forudpport in54045405;dofwAddSrcIpPortProto10.17.148.${svr} ${udpport} udp; done; done;#Apply changesfirewall-cmd --reload;#Setup pubkey so all those nodes can ssh to each othercd .ssh/cat > id_rsa.pub << EOF<CHECK OTHER BOX FOR THIS KEY>EOF#Setupprivatekeytouch id_rsa;chmod600id_rsa;cat > id_rsa << EOF<CHECK OTHER BOX FOR THIS KEY>EOFcat id_rsa.pub >> authorized_keys;#change hacluster passwordpasswd haclusterNew Password: <KEY IN LASTPASS>Confirm Password: <KEY IN LASTPASS>#Enable clusterlvmconf --enable-cluster;#Create directoryforiscsi mountmkdir -p /data/mvai-dev;# Enable pacemaker daemonsystemctl enable pcsd;systemctl start pcsd;systemctl status pcsd;#DO THIS PART ON01NODE (e.g. serverxyzl01.xyz.domain)#Authenticate hacluster onnewnodepcs cluster auth serverxyzl07.xyz.domain#Add1newjournal to /dev/mapper/vg_mvai--dev-lv_data_mvai--devgfs2_jadd -j1 /dev/mapper/vg_mvai--dev-lv_data_mvai--dev#Update STONITH host list withnewnodepcs stonith update iscsi-stonith-device pcmk_host_list="serverxyzl01.xyz.domain serverxyzl02.xyz.domain serverxyzl03.xyz.domain serverxyzl04.xyz.domain serverxyzl05.xyz.domain serverxyzl06.xyz.domain serverxyzl07.xyz.domain"#Add thenewnode to the existing clusterpcs cluster node add serverxyzl07.xyz.domain#DO THIS PART ON NEW NODE:pcs cluster startpcs cluster enable#Add'network.service'to the After variable in /etc/systemd/system/multi-user.target.wants/corosync.servicesystemctl daemon-reload;#Bounce thenewnoderebootSSH to Master node in Openshift and make the new node schedulable after it came up from rebooting
oc adm manage-node serverxyzl07.xyz.domain --schedulable





.png?version=1&modificationDate=1607006756007&cacheVersion=1&api=v2)







