-
[Kubernetes] 설치 명령어 모음인프라/Kubernetes 2020. 11. 26. 11:11
Docker 설치
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
sudo yum update -y && sudo yum install -y \ containerd.io-1.2.13 \ docker-ce-19.03.11 \ docker-ce-cli-19.03.11
sudo mkdir /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", "storage-opts": [ "overlay2.override_kernel_check=true" ] } EOF
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo systemctl daemon-reload sudo systemctl restart docker
sudo systemctl enable docker
쿠버네티스 클러스터 설치
sudo modprobe br_netfilter echo "br_netfilter" > /etc/modules-load.d/br_netfilter.conf 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
sudo systemctl stop firewalld sudo systemctl disable firewalld
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg exclude=kubelet kubeadm kubectl EOF
# Set SELinux in permissive mode (effectively disabling it) sudo setenforce 0 sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes sudo systemctl enable --now kubelet
쿠버네티스 Master Node일 경우
kubeadm init --pod-network-cidr 172.16.0.0/16
cidr network대역은 선택
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> /etc/profile source /etc/profile
curl https://docs.projectcalico.org/manifests/calico.yaml -O
vi calico.yaml /CALICO_IPV4POOL_CIDR # pod-network-cidr 부분과 일치시켜주도록 변경
kubectl apply -f calico.yaml
쿠버네티스 Slave Node일 경우
# Master Node에서 kubeadm init를 통해 생성된 kubeadm join ... 명령문 넣으면 끝 kubeadm join ...
'인프라 > Kubernetes' 카테고리의 다른 글
[Kubernetes] private docker registry Pod 설치 (0) 2020.12.02 [Kubernetes] Visual하게 DashBoard를 설치, 접속해보자 (2) 2020.11.26 [Kubernetes] Horizontal Pod Autoscaler (0) 2020.11.25 [Kubernetes] 쿠버네티스 설치하기 (7) - Performing a Rolling Update (0) 2020.11.23 [Kubernetes] 쿠버네티스 설치하기 (6) - Running Multiple Instances of Your App (0) 2020.11.20