首页
技术小册
AIGC
面试刷题
技术文章
MAGENTO
云计算
视频课程
源码下载
PDF书籍
「涨薪秘籍」
登录
注册
第一章:说明
第二章:节点配置
2.1. 工具准备
2.2. CheckList
2.2.1. 确保禁用swap分区
2.2.2. 确保mac地址唯一
2.2.3. 确保product_uuid唯一
2.2.4. 确保关闭防火墙
2.2.5. 确保时区准确,时间同步服务开启
2.2.6. 配置内核参数
2.2.7. 开启ipvs和br_netfilter内核模块
第三章:安装依赖服务
3.1. 部署Nginx LB
3.2. 部署containerd
3.2.1. 部署containerd服务端
3.2.2. 配置crictl客户端
第四章:部署Kubernetes
4.1. 安装集群
4.1.1. 配置主机名解析
4.1.2. 安装二进制文件
4.1.3. 初始化控制平面
4.1.4. 初始化数据平面
4.1.5. 配置kube-proxy为ipvs模式
4.1.6. 验证集群状态
4.2. 部署插件和必要服务
4.2.1. 部署CNI插件
4.2.2. 部署ingress controller
4.2.3. 部署metrics-server
4.2.4. 安装kubernetes-dashboard
4.2.5. 安装nfs-storage-class
当前位置:
首页>>
技术小册>>
Kubernetes合辑1-安装Kubernetes
小册名称:Kubernetes合辑1-安装Kubernetes
Nginx LB主要是用来给 Ingress Controller 负载流量以及为多个Master节点ApiServer负载流量。当前集群为单节点,可以不用配置ApiServer的负载均衡器,但为了方便后续扩展,这里也配置下负载均衡。 ``` [root@maxiaoke deploy-kubernetes]# gosh cmd -H 10.4.7.80 "yum install -y nginx nginx-mod-stream" [root@maxiaoke deploy-kubernetes]# gosh cmd -H 10.4.7.80 "mkdir /etc/nginx/conf.d/stream -p" [root@maxiaoke deploy-kubernetes]# gosh push -H 10.4.7.80 conf/nginx/nginx.conf /etc/nginx/ [root@maxiaoke deploy-kubernetes]# gosh push -H 10.4.7.80 conf/nginx/apiserver.conf /etc/nginx/conf.d/stream/ [root@maxiaoke deploy-kubernetes]# gosh cmd -H 10.4.7.80 "nginx -t" 10.4.7.80 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@maxiaoke deploy-kubernetes]# gosh cmd -H 10.4.7.80 "systemctl start nginx;systemctl enable nginx" ``` conf/nginx/nginx.conf: ``` user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; include /usr/share/nginx/modules/*.conf; events { worker_connections 4096; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; log_format access '$time_local|$remote_addr|$upstream_addr|$status|' '$upstream_connect_time|$bytes_sent|' '$upstream_bytes_sent|$upstream_bytes_received' ; access_log /var/log/nginx/access.log access; error_log /var/log/nginx/error.log; gzip on; map $http_upgrade $connection_upgrade { default upgrade; '' close; } include /etc/nginx/conf.d/http/*.conf; } stream { log_format proxy '$time_local|$remote_addr|$upstream_addr|$protocol|$status|' '$session_time|$upstream_connect_time|$bytes_sent|$bytes_received|' '$upstream_bytes_sent|$upstream_bytes_received' ; access_log /var/log/nginx/stream_access.log proxy; error_log /var/log/nginx/stream_error.log; include /etc/nginx/conf.d/stream/*.conf; } ``` conf/nginx/apiserver.conf: ``` upstream kube-apiserver { server 10.4.7.81:6443 max_fails=1 fail_timeout=60s ; # server 10.4.7.82:6443 max_fails=1 fail_timeout=60s ; # server 10.4.7.83:6443 max_fails=1 fail_timeout=60s ; } server { listen 0.0.0.0:6443 ; allow 192.168.0.0/16; allow 10.0.0.0/8; deny all; proxy_connect_timeout 2s; proxy_next_upstream on; proxy_next_upstream_timeout 5; proxy_next_upstream_tries 1; proxy_pass kube-apiserver; access_log /var/log/nginx/kube-apiserver.log proxy; } ```
上一篇:
第三章:安装依赖服务
下一篇:
3.2. 部署containerd
该分类下的相关小册推荐:
Kubernets合辑14-日志收集
云原生-K8S入门实战
Kubernets合辑2-部署Ingress
Kubernetes中文教程(二)
Kubernets合辑6-服务发现
Kubernetes中文教程(四)
Kubernets合辑11-持续集成
Kubernets合辑10-网络
Kubernets合辑13-集群监控
Kubernetes中文教程(五)
Kubernets合辑12-配置中心
Kubernetes中文教程(一)