#云原生征文#Kubernetes集群部署
source link: https://blog.51cto.com/u_15397018/5367484
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
#云原生征文#Kubernetes集群部署
推荐 原创一、环境要求
系统版本:CentOS7.x版本
硬件配置:内存2GB以上 cpu2核以上 硬盘大于30G
集群网络配置:集群中所有服务器内网必须互通,并且需要访问外网来拉取镜像
禁用swap分区
二、k8s基础环境操作:
1、关闭防火墙:
[root@localhost ~]# systemctl disable firewalld
2、关闭selinux:
[root@localhost ~]# getenforce
3、关闭swap分区:
临时关闭:
永久关闭:注释掉/etc/fstab文件中的swap行
4、进行hosts文件编辑:
192.168.8.146 k8s-master
192.168.8.141 k8s-node1
192.168.8.129 k8s-node2
5、将桥接的IPv4流量传递到iptables的链
> net.bridge.bridge-nf-call-ip6tables = 1
> net.bridge.bridge-nf-call-iptables = 1
> EOF
6、开启IP转发功能
三、安装docker(三台机器都操作)
1、卸载旧版docker
2、安装一些必要的系统工具
3、配置docker的稳定版本仓库
4、更新安装包索引
5、安装docker ce
6、开机自启和启动docker
7、查看docker版本
8、添加阿里云YUM软件源
[Kubernetes]
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
9、
10、
安装kubeadm,kubelet和kubectl
11、由于版本更新频繁,这里指定版本号部署:
[root@localhost ~]# systemctl enable kubelet
四、部署Kubernetes Master(这个在master主机里操作):
注意:192.168.8.146ip是master主机的ip地址
五、配置kubectl访问集群(三台机器操作):
1、
2、
3、
六、Master安装flannel(主机master里操作):
1、查看索引pod
2、查看节点
七、加入node节点(在两台node上做):
1、
2、查看node1节点是否成功(在node1上做)
八、查看节点信息(在master操作)
九、部署dashboard(master主机操作)
1、
2、安装dashboard
3、使用master节点ip地址+端口来访问,协议是https的
查看Dashboard端口信息:
4、以我自己的服务器为访问对象,使用 https://172.16.204.130:30310即可访问
5、Token
[root@k8s-master~]#kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
[root@k8s-master ~]# kubectl get secret -n kube-system
6、查看token的具体信息
7、把密令输入在令牌中
8、登陆成功的页面:
【本文正在参加云原生有奖征文活动】,活动链接:https://ost.51cto.com/posts/12598”;
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK