首页 > 其他分享 >k8s安装-简洁版

k8s安装-简洁版

时间:2023-01-04 15:14:10浏览次数:49  
标签:简洁 get sudo apt etc systemctl docker k8s 安装

安装 openssh-server,提供远程连接

sudo apt install -y openssh-server
sudo apt-get remove vim-common
apt-get install vim
sudo vi /etc/ssh/sshd_config
sudo systemctl restart ssh
sudo echo k8s-node-2 > /etc/hostname
sudo vim /etc/hosts
sudo ufw enable
sudo ufw allow 6443
sudo ufw status
sudo swapoff -a && sudo sed -i 's/^\/swap.img\(.*\)$/#\/swap.img \1/g' /etc/fstab && free

 

安装docker

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
 echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
sudo apt-get update
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl list-unit-files | grep docker
sudo systemctl stop containerd.service
sudo cp /etc/containerd/config.toml /etc/containerd/config.toml.bak
sudo containerd config default > $HOME/config.toml
sudo cp $HOME/config.toml /etc/containerd/config.toml
sudo sed -i "s#registry.k8s.io/pause#registry.cn-hangzhou.aliyuncs.com/google_containers/pause#g" /etc/containerd/config.toml
sudo sed -i "s#SystemdCgroup = false#SystemdCgroup = true#g" /etc/containerd/config.toml

sudo systemctl restart docker.service
#开机自启
sudo systemctl enable docker.service
#开机自启
sudo systemctl enable --now containerd.service
systemctl list-unit-files | grep docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://hnkfbj7x.mirror.aliyuncs.com"],
    "exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo docker info

 

 安装 k8s 1.25.3 所需依赖

sudo apt-get update && sudo apt-get install -y apt-transport-https
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | sudo apt-key add - 
sudo vim /etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
sudo apt-get update
sudo apt-get install -y kubelet=1.25.3-00 kubeadm=1.25.3-00 kubectl=1.25.3-00
sudo systemctl daemon-reload
sudo systemctl restart kubelet
sudo systemctl enable kubelet
sudo systemctl status kubelet

 

#该命令执行完会输出一条join命令,需要node节点执行,需要复制保存下载
sudo kubeadm init --image-repository=registry.aliyuncs.com/google_container

 

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl cluster-info

一些查看命令
复制代码
#查看集群信息
kubectl cluster-info
#查看pod信息 kubectl get pods --all-namespaces -o wide
#查看节点信息
kubectl get nodes
#查看cs信息
kubectl get cs
复制代码

 配置网络





标签:简洁,get,sudo,apt,etc,systemctl,docker,k8s,安装
From: https://www.cnblogs.com/excellencesy/p/17024863.html

相关文章

  • Linux下rpm安装MySQL及配置
    Linux下rpm安装MySQL及配置xupeng1644已于2022-03-2211:38:47修改2747收藏15分类专栏:Linux文章标签:rpmMySQLLinux版权Linux专栏收录该内容55篇文章1订阅订......
  • k8s发布周期
    https://kubernetes.io/zh-cn/releases/release/#the-release-cycleKubernetes目前大约每年发布三次。......
  • MongoDB6.0的安装「2023年」
    你好,我是悦创。优质原文格式:https://bornforthis.cn/column/crawler/supplement/mongodb-install.html点进去有惊喜。吐槽,这篇博客的产生是因为本人被MongoDB的安装坑......
  • VS2022中ArcGIS Pro SDK for .NET安装和卸载指南
    VS2022中ArcGISProSDKfor.NET安装和卸载指南   安裝ArcGISProSDKfor.NET   升级ArcGISProSDKfor.NET   卸载ArcGISProSDKfor.NET   使......
  • Docker在ubuntu下的安装和使用
    ---------------------------容器安装与验证---------------------------安装参考:https://www.runoob.com/docker/ubuntu-docker-install.html安装是否安装验证:$ sudo ......
  • 通过xshell在linux上安装nginx1.12.0
    0)环境安装Nginx是C语言开发,建议在Linux上运行,当然,也可以安装Windows版本,本篇则使用CentOS7作为安装环境。 0.1gcc安装安装nginx需要先将官网下载的源码进......
  • 本地python环境安装kylin项目依赖时报认证错误信息
    问题描述:项目需要连接kylin数据库查询数据,本地安装kylin项目的依赖环境后报认证错误python版本3.732位pycharm版本2022版成功方法:更换解释器选择无解释器,创建虚......
  • Ubuntu 安装MySQL 并 重置root密码
    注:如果不是root用户,命令前需加上sudo1、安装MySQLapt-getinstallmysql-server如果报错则更新源 apt-getupdate  2、安装好MySQL后,启用MySQL servicemysql......
  • 使用ansible-playbook自动化安装MySQL主从
    【使用自动化安装MySQL主从架构】说明:使用ansible-playbook 自动化安装MySQL主从+ mysqld-exporter的采集数据+ xtrabackup备份【剧本说明】以下文件在roles目录......
  • gcc 8.3.0 源码编译安装
    背景vpp高版本编译需要高版本的gcc支持,不然编译过程中很多编译参数都识别不了。但是服务器此时有没有连接互联网,故需要先将高版本的gcc源代码通过互联网下载下来,移动到服......