# k8s-study **Repository Path**: thousmile/k8s-study ## Basic Information - **Project Name**: k8s-study - **Description**: k8s 学习的命令 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-04-28 - **Last Updated**: 2024-06-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 一、基础环境部署 ### [参考](https://blog.csdn.net/weixin_40548182/article/details/129179182) ## 1、修改主机名和配置 hosts 部署 1个master 和 2个node 节点 ```shell ### 在192.168.239.41执行 hostnamectl set-hostname k8s-node1 && hostname ### 在192.168.239.42执行 hostnamectl set-hostname k8s-node2 && hostname ### 在192.168.239.43执行 hostnamectl set-hostname k8s-node3 && hostname ### 在所有节点上执行 cat >> /etc/hosts< /etc/exports # 主节点启动,centos 7。使用 systemctl enable nfs --now # 主节点启动,centos 8以上。使用 systemctl enable nfs-server --now # 所有节点都要安装 systemctl enable rpcbind --now showmount -e k8s-master # 临时 在其他节点上挂在 mount -t nfs k8s-master:/data/nfs /data/nfs # 开机启动挂载 在其他节点上挂在 vi /etc/fstab k8s-master:/data/nfs /data/nfs nfs defaults 0 0 echo "hello nfs " > /data/nfs/hello.txt ### helm 方式,添加 nfs 到 k8s helm repo add kubesphere https://charts.kubesphere.io/main helm install managed-nfs-storage kubesphere/nfs-client-provisioner -n kube-system --version 4.0.11 \ --set nfs.server=k8s-master \ --set nfs.path=/data/nfs \ --set storageClass.name=managed-nfs-storage \ --set storageClass.defaultClass=true ## 导出镜像 ctr -n=k8s.io i export images.tar.gz --platform=linux/amd64 docker.io/bitnami/elasticsearch:8.6.2-debian-11-r10 ## 导入镜像 ctr -n=k8s.io i import images.tar.gz ```