yum install docker -y
systemctl enable docker
systemctl start docker
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
minikube version
minikube start --driver=docker --force
minikube status
curl -LO https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version
Deploy Sample POd:
https://kubernetes.io/docs/concepts/workloads/pods/
=======================================================================
Master
1 hostnamectl set-hostname k8master
2 yum install docker -y
3 systemctl start docker;systemctl enable docker
4 sudo setenforce 0
5 Add K8S Repo:
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
EOF
6.yum repolist
7 sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes --disableplugin=priorities
8 kubeadm init
--> Note down kubeadm join commands:
9 kubectl get nodes
10 mkdir -p $HOME/.kube
11 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
12 sudo chown $(id -u):$(id -g) $HOME/.kube/config
13 export KUBECONFIG=/etc/kubernetes/admin.conf
14. kubectl apply -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
15 kubectl get nodes
17 kubectl get pods -n kube-system
18 kubectl get nodes
Worker:
1 hostnamectl set-hostname k8worker1
2 yum install docker -y
3 systemctl start docker;systemctl enable docker
4 sudo setenforce 0
5 Add K8S Repo:
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
EOF
6.yum repolist
7 sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes --disableplugin=priorities
8. Use join comamnd to connect control plain: join command and token you can take from master
kubeadm join 172.31.63.238:6443 --token 15zdfy.iogdr2v5ngur6cwo \
> --discovery-token-ca-cert-hash sha256:6fbc63b2d51467ec36482022d207af7672e1330168ceee673eb4182538f324fb
No comments:
Post a Comment