Skip to content

Instantly share code, notes, and snippets.

@TyeolRik
Last active June 22, 2022 00:45
Show Gist options
  • Save TyeolRik/8c6023d0bd8914fdbdf41852c16d5a90 to your computer and use it in GitHub Desktop.
Save TyeolRik/8c6023d0bd8914fdbdf41852c16d5a90 to your computer and use it in GitHub Desktop.
#!/bin/bash
dnf update -y &&\
dnf install -y kernel-devel kernel-header* make gcc elfutils-libelf-devel
echo "Installing Docker"
yum install -y yum-utils telnet &&\
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &&\
yum install -y --allowerasing docker-ce docker-ce-cli containerd.io docker-compose-plugin &&\
systemctl enable docker.service &&\
systemctl start docker.service
echo "Docker install complete"
echo "Open Port"
# Dashboard
firewall-cmd --zone=public --permanent --add-port 8443/tcp
firewall-cmd --reload
echo "Check br_netfilter"
printf "br_netfilter" > /etc/modules-load.d/k8s.conf
printf "net.bridge.bridge-nf-call-ip6tables = 1\nnet.bridge.bridge-nf-call-iptables = 1" > /etc/sysctl.d/k8s.conf
sysctl --system
echo "SELinux permissive"
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
echo "Swap off"
swapon && cat /etc/fstab
swapoff -a && sed -i '/swap/s/^/#/' /etc/fstab
echo "Install CEPH"
cat <<EOF | tee ./initial-ceph.conf
[global]
osd crush chooseleaf type = 0
EOF
dnf install -y centos-release-ceph-pacific.noarch
dnf install -y cephadm
cephadm add-repo --release pacific
cephadm install ceph-common
cephadm bootstrap --mon-ip $(hostname -I | cut -d ' ' -f1) --config ./initial-ceph.conf
ceph orch apply osd --all-available-devices # There are available HDDs in this node, host.
ceph orch device ls # For checking connected devices' name
# If osd isn't applied automatically, type below command
# ls -al /dev/ # Check what disk is mounted. (ex. /dev/sda, /dev/sdb, /dev/sdc, /dev/sdd)
# ceph orch daemon add osd $(hostname):/dev/sdd # If you want to connect CEPH and disk /dev/sdd
# dnf install -y ceph-mgr-dashboard
# ceph mgr services # Check Dashboard IP:Port
ceph fs volume create kubernetes &&\
ceph fs ls
ceph mds stat &&\
ceph mon dump &&\
ceph auth get-or-create client.cephfs mon 'allow r' osd 'allow rwx pool=kubernetes' &&\
ceph auth get client.admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment