쿠버네티스(Kubernetes) 설치 명령어
연습해 본 명령어 모음
<공통>
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
sudo systemctl disable firewalld
sudo systemctl stop firewalld
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
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
curl -s https://get.docker.com | sudo sh
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status 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 systemctl restart docker
sudo systemctl status docker
sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
<마스터 노드>
sudo kubeadm init --pod-network-cidr=10.96.0.0/12 --apiserver-advertise-address=192.168.126.133
sudo systemctl enable kubelet
sudo yum erase -y containerd
sudo yum install -y containerd.io
sudo rm -f /etc/containerd/config.toml
sudo systemctl enable containerd
sudo systemctl restart containerd
sudo systemctl status containerd
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
systemctl status kubelet
kubeadm version -o short
kubectl version --short
kubelet --version
kubectl get nodes
kubectl get pods --all-namespaces
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
kubectl proxy --port=8001 --address=192.168.126.133 --accept-hosts='^*$'
# token create
kubeadm token create --print-join-command
<워커 노드>
sudo systemctl enable kubelet
sudo kubeadm join 192.168.126.133:6443 --token <token> --discovery-token-ca-cert-hash <discovery-token-ca-cert-hash>
sudo yum erase -y containerd
sudo yum install -y containerd.io
sudo rm -f /etc/containerd/config.toml
sudo systemctl enable containerd
sudo systemctl restart containerd
sudo systemctl status containerd
끝.
'OS' 카테고리의 다른 글
[Linux] Ubuntu Nexus Repository Manager 서비스 등록 (0) | 2019.08.31 |
---|---|
CentOS 6 설치 및 부가 설치 가이드 (0) | 2012.02.04 |
댓글