오늘만살자
Centos8 Kubernetes Install 본문
root 로 진행
master 1대
work 2대
# hostnamectl set-hostname master
# master / work 모두 작성
cat <<EOF>> /etc/hosts
172.16.135.211 master
172.16.135.212 work01
172.16.135.213 work02
EOF
#docker install
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf repolist -v
dnf list docker-ce --showduplicates | sort -r
sudo dnf install docker-ce-3:18.09.1-3.el7
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl enable --now docker
systemctl is-active docker
systemctl is-enabled docker
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose
sudo mv docker-compose /usr/local/bin && sudo chmod +x /usr/local/bin/docker-compose
curl -L https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
#iptable setting
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.d/k8s.conf ...
확인
#disable seliunx
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
#disable swap
swapoff -a
vi /etc/fstab
swap 부분주석 처리
reboot
#kubernetes install
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
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
EOF
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet && systemctl start kubelet
kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address={ip address}
#복사해둔다.
kubeadm join {ip address}:6443 --token 2w88zz.akk7unefal9ewvj4 \
--discovery-token-ca-cert-hash sha256:5b0584f26ae68f1bbe83e10a151ef6c9457d8be00a1615c9bc340528a76f8dd9
export KUBECONFIG=/etc/kubernetes/admin.conf
kubectl apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml
kubectl get pods --all-namespaces
#work01, work02에서
#복사한 값을 입력한다.
kubeadm join {ip address}:6443 --token 2w88zz.akk7unefal9ewvj4 \
--discovery-token-ca-cert-hash sha256:5b0584f26ae68f1bbe83e10a151ef6c9457d8be00a1615c9bc340528a76f8dd9
#master 에서
kubectl get nodes
'쿠버네티스' 카테고리의 다른 글
ubuntu 16.04 kubernetes uninstall (0) | 2020.05.20 |
---|---|
kubernetes 종료하기 (0) | 2020.05.12 |
gcloud Error with pre-create check: "google: could not find default credentials. (0) | 2020.03.07 |
worker join token 불러오기 (0) | 2020.03.03 |
kubernetes install (0) | 2020.02.27 |
Comments