Docker 로 GnuBoard 설치하고 운영하기 1탄. 정보
그누보드5 Docker 로 GnuBoard 설치하고 운영하기 1탄.본문
Ubuntu 기반에서 Docker 설치하기 1탄.
방화벽 disable
sudo ufw disable
스왑 메모리 Off
sudo swapoff -a && sudo sed -i '/swap/s/^/#/' /etc/fstab
docker 설치하기 위한 기본 유틸 셋팅
sudo apt-get -y update
sudo apt-get -y install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Docker 설치하기 위해 레파지토리 등록
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Docker 설치
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl enable containerd
sudo systemctl start containerd
sudo mkdir -p /etc/docker
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
K8S 동시 설치용
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sudo sysctl --system
K8S 설치
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl daemon-reload
sudo systemctl restart kubelet
sudo rm /etc/containerd/config.toml
sudo systemctl restart containerd
Master 노드 설치
sudo kubeadm init
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc
kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml
//k8s 연결
kubeadm join 192.168.25.31:6443 --token 516wsb.f7ubkpu109urzibs \
--discovery-token-ca-cert-hash sha256:1ae5a6f972f6982b4068ce5e96fc46df3dc25c4361fee672afc251777e92a7f6
//Volume 설치용 NFS
sudo apt install -y nfs-common net-tools
mkdir /nfs
mount -t nfs -o vers=3 192.168.X.X:/volume1/web /nfs
192.168.X.X:/volume1/web /nfs nfs defaults 0 0
timedatectl set-timezone Asia/Seoul
timedatectl show
//swarm 연결
docker swarm init --advertise-addr
docker swarm join --token SWMTKN-1-2anx9ctzm3ffwbktlnr501ho6gqr3vb370c5d6anyqws07591f-2r3ywtldirv6o6gcdio24fan4 192.168.X.X:2377
#groupadd -g 999 docker
#https://github.com/jakubhajek/elasticsearch-docker-swarm/blob/master/stack-elastic.yml
Docker APP 성능 향상 및 ES 관련 옵션 설정
# elasticsearch coordinating node
/etc/security/limits.conf
* hard memlock unlimited
* soft memlock unlimited
* hard nofile 65536
* soft nofile 65536
* hard nproc 65536
* soft nproc 65536
vim /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
exit 0
/etc/sysctl.conf
vm.max_map_count=262144
vm.overcommit_memory=1
net.core.somaxconn=1024
/lib/systemd/system/docker.service
LimitMEMLOCK=infinity
#sudo adduser allinone --disabled-password
#sudo usermod -aG sudo allinone
1
댓글 2개
스왑 메모리 Off 하는 이유가 멀까요?
@열혈처리 아, 죄송합니다. K8s 못봤습니다.