安装案例:

系统:Centos
可以多台Master(Master不能低于3台)多台Node
此案例使用三台Master两台Node,用户名root,密码均为123456

master	192.168.20.183
master 192.168.20.96
master 192.168.20.171
node 192.168.20.172
node    192.168.20.54

安装Master集群

下载项目:

git clone https://github.com/zdwork/k8s-install.git
cd k8s-install

修改 conf/master-install.conf
内容如下:

#!/bin/bash
#User-defined information
export node=3 #集群数量
export node_ip="192.168.20.183 192.168.20.96 192.168.20.171" #服务器的ip,以空格分割
export node_name="master-01 master-02 master-03" #主机名 自定义,以空格分割
export node_pass="123456 123456 123456" #每台服务器的root密码,以空格分割
export apiserver_vip="192.168.20.240"#高可用IP 注意此ip要没有被占用
export apiserver_vip_port="4443"
export flaneld_interface="ens33" #你的网卡
export vip_interface="ens33" #你的网卡
export haproxy_name="admin"
export haproxy_pass="123456"
export haproxy_status_port="8000"

安装:

./install.sh

脚本执行完后会打打印出如下信息:

 ---------------- etcd --------------------------------
192.168.20.183::master-01
  Active: active (running) since 三 2018-11-28 16:03:46 CST; 1h 44min ago
192.168.20.96::master-02
  Active: active (running) since 三 2018-11-28 16:03:47 CST; 1h 44min ago
192.168.20.171::master-03
  Active: active (running) since 三 2018-11-28 16:04:07 CST; 1h 43min ago
---------------- kube-apiserver -----------------------
192.168.20.183::master-01
  Active: active (running) since 三 2018-11-28 16:07:07 CST; 1h 40min ago
192.168.20.96::master-02
  Active: active (running) since 三 2018-11-28 16:07:20 CST; 1h 40min ago
192.168.20.171::master-03
  Active: active (running) since 三 2018-11-28 16:07:32 CST; 1h 40min ago
---------------- kube-scheduler ------------------------
192.168.20.183::master-01
  Active: active (running) since 三 2018-11-28 16:08:26 CST; 1h 39min ago
192.168.20.96::master-02
  Active: active (running) since 三 2018-11-28 16:08:26 CST; 1h 39min ago
192.168.20.171::master-03
  Active: active (running) since 三 2018-11-28 16:08:26 CST; 1h 39min ago
---------------- kube-controller_manager ----------------
192.168.20.183::master-01
  Active: active (running) since 三 2018-11-28 16:07:59 CST; 1h 40min ago
192.168.20.96::master-02
  Active: active (running) since 三 2018-11-28 16:09:08 CST; 1h 38min ago
192.168.20.171::master-03
  Active: active (running) since 三 2018-11-28 16:08:02 CST; 1h 40min ago
---------------- keepalived ------------------------------
192.168.20.183::master-01
  Active: active (running) since 三 2018-11-28 16:06:31 CST; 1h 41min ago
192.168.20.96::master-02
  Active: active (running) since 三 2018-11-28 16:06:33 CST; 1h 41min ago
192.168.20.171::master-03
  Active: active (running) since 三 2018-11-28 16:06:34 CST; 1h 41min ago
---------------- haproxy ---------------------------------
192.168.20.183::master-01
  Active: active (running) since 三 2018-11-28 16:05:03 CST; 1h 43min ago
192.168.20.96::master-02
  Active: active (running) since 三 2018-11-28 16:05:20 CST; 1h 42min ago
192.168.20.171::master-03
  Active: active (running) since 三 2018-11-28 16:05:34 CST; 1h 42min ago
---------------- flanneld --------------------------------
192.168.20.183::master-01
  Active: active (running) since 三 2018-11-28 16:04:39 CST; 1h 43min ago
192.168.20.96::master-02
  Active: active (running) since 三 2018-11-28 16:04:41 CST; 1h 43min ago
192.168.20.171::master-03
  Active: active (running) since 三 2018-11-28 16:04:43 CST; 1h 43min ago
################ Current cluster state ####################
NAME                 STATUS    MESSAGE             ERROR
scheduler            Healthy   ok                  
controller-manager   Healthy   ok                  
etcd-1               Healthy   {"health":"true"}  
etcd-2               Healthy   {"health":"true"}  
etcd-0               Healthy   {"health":"true"}  

安装Node

修改 conf/node-install.conf
内容如下:

#!/bin/bash

#User-defined information
export node=2
export node_ip="192.168.20.172 192.168.20.54"
export node_name="node-1 node-2"
export node_pass="123456 123456"
export flaneld_interface="ens33"

安装:

./install.sh

脚本执行完后会打打印出如下信息:

---------------- flanneld --------------------------------
192.168.20.172::node-1
  Active: active (running) since 三 2018-11-28 18:28:34 CST; 26s ago
192.168.20.54::node-2
  Active: active (running) since 三 2018-11-28 18:28:37 CST; 25s ago
---------------- docker --------------------------------
192.168.20.172::node-1
  Active: active (running) since 三 2018-11-28 18:28:38 CST; 24s ago
192.168.20.54::node-2
  Active: active (running) since 三 2018-11-28 18:28:42 CST; 21s ago
---------------- kubelet --------------------------------
192.168.20.172::node-1
  Active: active (running) since 三 2018-11-28 18:28:52 CST; 11s ago
192.168.20.54::node-2
  Active: active (running) since 三 2018-11-28 18:28:54 CST; 10s ago
---------------- kube-proxy --------------------------------
192.168.20.172::node-1
  Active: active (running) since 三 2018-11-28 18:28:59 CST; 5s ago
192.168.20.54::node-2
  Active: active (running) since 三 2018-11-28 18:29:00 CST; 5s ago

测试:

[root@localhost k8s-install]# bash
[root@master-01 k8s-install]# source /etc/profile
[root@master-01 k8s-install]# kubectl get nodes
NAME      STATUS    ROLES     AGE       VERSION
node-1    Ready     <none>    35s       v1.10.4
node-2    Ready     <none>    34s       v1.10.4
[root@master-01 k8s-install]#

K8s一键安装的更多相关文章

  1. kubespray 一键安装k8s集群

    1. clone代码 git clone https://github.com/kubernetes-incubator/kubespray.git 2. 添加inventory/inventory ...

  2. 用 edgeadm 一键安装边缘 K8s 集群和原生 K8s 集群

    背景 目前,很多边缘计算容器开源项目在使用上均存在一个默认的前提:用户需要提前准备一个标准的或者特定工具搭建的 Kubernetes 集群,然后再通过特定工具或者其他方式在集群中部署相应组件来体验边缘 ...

  3. kubernetes实战(二十):k8s一键部署高可用Prometheus并实现邮件告警

    1.基本概念 本次部署使用的是CoreOS的prometheus-operator. 本次部署包含监控etcd集群. 本次部署适用于二进制和kubeadm安装方式. 本次部署适用于k8s v1.10版 ...

  4. k3s单机版安装部署 附一键安装脚本

    作者:SRE运维博客 博客地址: https://www.cnsre.cn/ 文章地址:https://www.cnsre.cn/posts/211109907029/ 相关话题:https://ww ...

  5. CentOS6.x生产环境下一键安装mono+jexus的脚本,自启动,带服务,版本号自控

    转自: http://linuxdot.net/bbsfile-3784 1.支持哪些个平台?答:暂时仅支持CentOS6.x平台,7.x未测试,欢迎测试并到群里反馈给我(昵称:无聊人士) 2.一键安 ...

  6. 在centos 7.0上利用yum一键安装mono

    首先我们需要先配置一下yum源中mono的引用说明: 第一步: vi /etc/yum.repos.d/mono.repo 第二步:在刚打开的文件中编辑如下内容 [mono]name=monobase ...

  7. 转:CentOS/Debian/Ubuntu一键安装LAMP(Apache/MySQL/PHP)环境

    CentOS/Debian/Ubuntu一键安装LAMP(Apache/MySQL/PHP) 今天遇到一个网友提到需要在Linux VPS服务器中安装LAMP(Apache/MySQL/PHP)网站环 ...

  8. 使用 shell 脚本实现 LANMP 一键安装

    使用 shell 脚本来实现 LANMP 系统的一键安装.使用的操作系统是 CentOS 6 ,不区分 32 位和 64 位,要求机器可以连通互联网.支持 LAMP 和 LNMP ,MySQL 支持 ...

  9. CentOS 6、7下pptp vpn一键安装脚本

    之前有折腾过<CentOS 6.7下IPSEC/L2TP VPN一键安装脚本>,不稳定.不支持IOS,因此换成pptp,并已经添加到<lnmp一键安装包>.这个脚本可以单独使用 ...

随机推荐

  1. Blazor+Dapr+K8s微服务之开发环境调试

    1         安装Dapr开发调试环境 1.1         Dapr 完整安装模式不支持开发调试 在上一篇随笔<Blazor+Dapr+K8s微服务之服务调用>中,我们通过为每个 ...

  2. labuladong 05.16 微信直播

    labuladong 05.16 微信直播 一.基础: 1.校招相关 1)扫盲 秋招:8-10月 提前批:7月 暑期实习:3-5月 非必须 2)关注公司前景,部门信息,公司财报 企查查,天眼查,多获取 ...

  3. 【linux】less 命令详解

    转自:https://www.cnblogs.com/GNblog/p/6932252.html less 工具也是对文件或其它输出进行分页显示的工具,应该说是linux正统查看文件内容的工具,功能极 ...

  4. WPF---数据模板(一)

    一.场景模拟 假设我们现在有如下需求: 我们需要在ListBox中的每个Item中显示某个成员的姓名.年龄以及喜欢的颜色,点击Item的时候,会在右边显示详细信息,同时也想让ListBox的样式变得好 ...

  5. wpf中INotifyPropertyChanged的用法

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Linq;using Sy ...

  6. pyspark启动与简单使用----本地模式(local)----shell

    在Spark中采用本地模式启动pyspark的命令主要包含以下参数:–master:这个参数表示当前的pyspark要连接到哪个master,如果是local[*],就是使用本地模式启动pyspark ...

  7. linux centos 网卡有关调试

    本文章出至于设置固定IP不起作用,名称也无法修改 1.设置网卡配置文件 打开文件 vi /etc/sysconfig/network-scripts/ifcfg-enp8s0 把NAME.DEVICE ...

  8. ORB_SLAM2 Tracking流程

  9. nginx 开启,关闭,重启

    2021-08-191. 启动 # 判断配置文件是否正确 cd /usr/local/nginx/sbin ./nginx -t # 启动 cd usr/local/nginx/sbin ./ngin ...

  10. 批量修改Linux密码脚本(Python)

    搭建环境 centos 7.4 使用脚本 python 批量修改connect用户的密码 生成密码为随机密码 保存为xls文档 #!/usr/bin/env python # -*- coding: ...