CentOS二进制安装Kubernetes
程序员文章站
2022-03-06 18:29:33
前言最近在私有云部署一套自动化运维平台;其中k8s是重头戏,这篇文章为大家分享一下二进制安装方式k8s架构图安装过程基本环境CentOS版本 7.9.2009Etcd 版本3.4.14Dockerk8s版本 1.17.16kube-apiserver服务安装下载并解压cd /softwget https://dl.k8s.io/v1.20.0/kubernetes-server-linux-amd64.tar.gztar -zxvf kubernete...
前言
最近在私有云部署一套自动化运维平台;
其中k8s是重头戏,这篇文章为大家分享一下二进制安装方式
k8s架构图
安装过程
-
基本环境
- CentOS版本 7.9.2009
- Etcd 版本3.4.14
- Docker
- k8s版本 1.17.16
-
kube-apiserver服务安装
- 下载并解压
cd /soft
wget https://dl.k8s.io/v1.20.0/kubernetes-server-linux-amd64.tar.gz
tar -zxvf kubernetes-server-linux-amd64.tar.gz
cd kubernetes
- 创建启动配置文件
mkdir /soft/kubernetes/server/conf/
vim /soft/kubernetes/server/conf/apiserver
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--port=8886"
KUBE_ETCD_SERVERS="--etcd-servers=http://10.9.0.46:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=169.169.0.0/16"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ResourceQuota"
KUBE_API_LOG="--logtostderr=false --log-dir=/home/k8s-t/log/kubernets --v=2"
KUBE_API_ARGS=" "
- 修改配置文件
vim /etc/systemd/system/kube-apiserver.service
[Unit]
Description=Kubernetes API Server
After=etcd.service
Wants=etcd.service
[Service]
EnvironmentFile=/soft/kubernetes/server/conf/apiserver
ExecStart=/soft/kubernetes/server/bin/kube-apiserver \
$KUBE_ETCD_SERVERS \
$KUBE_API_ADDRESS \
$KUBE_API_PORT \
$KUBE_SERVICE_ADDRESSES \
$KUBE_ADMISSION_CONTROL \
$KUBE_API_LOG \
$KUBE_API_ARGS
Restart=on-failure
Type=notify
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
- kube-controller-manger服务安装
- 创建启动配置文件
vim /soft/kubernetes/server/conf/controller-manager
KUBE_MASTER="--master=http://10.9.0.46:8886"
KUBE_CONTROLLER_MANAGER_ARGS=" "
- 修改配置文件
vim /etc/systemd/system/kube-controller-manager.service
[Unit]
Description=Kubernetes Scheduler
After=kube-apiserver.service
Requires=kube-apiserver.service
[Service]
EnvironmentFile=-/soft/kubernetes/server/conf/controller-manager
ExecStart=/soft/kubernetes/server/bin/kube-controller-manager \
$KUBE_MASTER \
$KUBE_CONTROLLER_MANAGER_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
- kube-scheduler服务安装
- 创建启动配置文件
vim /soft/kubernetes/server/conf/scheduler
KUBE_MASTER="--master=http://10.9.0.46:8886"
KUBE_SCHEDULER_ARGS="--logtostderr=true --log-dir=/home/k8s-t/log/kubernetes --v=2"
- 创建服务配置文件
vim /etc/systemd/system/kube-scheduler.service
[Unit]
Description=Kubernetes Scheduler
After=kube-apiserver.service
Requires=kube-apiserver.service
[Service]
User=root
EnvironmentFile=-/soft/kubernetes/server/conf/scheduler
ExecStart=/soft/kubernetes/server/bin/kube-scheduler \
$KUBE_MASTER \
$KUBE_SCHEDULER_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
- 将各个组件启动
systemctl daemon-reload
systemctl enable kube-apiserver.service
systemctl start kube-apiserver.service
systemctl enable kube-controller-manager.service
systemctl start kube-controller-manager.service
systemctl enable kube-scheduler.service
systemctl start kube-scheduler.service
总结
-
k8s改变了项目运维的方式,使得发布变得十分简单的同时降低了项目风险;
-
多动手多实践;
本文地址:https://blog.csdn.net/u012829124/article/details/112056142
上一篇: 微信小程序官方Demo部署测试
下一篇: 说明窗体设置
推荐阅读
-
CentOS7.x卸载与安装MySQL5.7的操作过程及编码格式的修改方法
-
CentOS安装mysql5.7 及简单配置教程详解
-
CentOS7.0下安装PHP5.6.30服务的教程详解
-
CentOS 7 MySql 解压版安装配置
-
CentOS6.5 编译安装lnmp环境
-
centos下fail2ban安装与配置详解
-
服务器(CentOS)安装配置mongodb-do前端while全栈-SegmentFault思否
-
用DNSPod和Squid打造自己的CDN (三) 安装CentOS Linux
-
阿里云 CentOS7.4 安装 Python3.6的方法讲解
-
基于centos7 安装python3.6.4出错的解决方法