vi /etc/fstab # # /etc/fstab # Created by anaconda on Mon Oct 3 15:41:00 2022 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=715915d4-5b52-469f-a69d-f92410a28415 /boot xfs defaults 0 0 #/dev/mapper/centos-swap swap swap defaults 0 0 swap前加个#号
mkdir ~/.kube vim ~/.kube/config # 添加k8s集群中的kubeconfig文件到该文件中,保存之后继续执行 kubectl get nodes
完整过程如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@k8s-master-01 ~]# chmod +x kubectl [root@k8s-master-01 ~]# mv kubectl /usr/local/bin/kubectl [root@k8s-master-01 ~]# kubectl get pods The connection to the server localhost:8080 was refused - did you specify the right host or port? [root@k8s-master-01 ~]# mkdir ~/.kube 您在 /var/spool/mail/root 中有邮件 [root@k8s-master-01 ~]# vim ~/.kube/config [root@k8s-master-01 ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master-01 Ready controlplane,etcd,worker 48m v1.19.15 k8s-node-02 Ready worker 34m v1.19.15 k8s-node-03 Ready worker 34m v1.19.15 [root@k8s-master-01 ~]#