Kubernetes 集群安装部署
etcd集群配置
master节点配置
[root@k8s ~]# yum -y install kubernetes-master etcd
2.配置 etcd 选项
[root@k8s ~]# cat /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://172.19.15.92:2380"
ETCD_LISTEN_CLIENT_URLS="http://172.19.15.92:2379,http://127.0.0.1:2379"
ETCD_MAX_SNAPSHOTS=""
ETCD_NAME="etcd1"
ETCD_HEARTBEAT_INTERVAL=6000
ETCD_ELECTION_TIMEOUT=30000 #[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://172.19.15.92:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://172.19.15.92:2379"
ETCD_INITIAL_CLUSTER="etcd1=http://172.19.15.92:2380,etcd2=http://172.19.15.93:2380,etcd3=http://172.19.15.94:2380"
nodes节点配置
[root@k8s-node1 ~]# yum -y install kubernetes-node etcd flannel docker
2.分别配置etcd,node1 与 node2 的配置方法相同,以 node1 配置文件为例说明
[root@k8s-node1 ~]# cat /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://172.19.15.93:2380"
ETCD_LISTEN_CLIENT_URLS="http://172.19.15.93:2379,http://127.0.0.1:2379"
ETCD_NAME="etcd2"
ETCD_HEARTBEAT_INTERVAL=6000
ETCD_ELECTION_TIMEOUT=30000 #[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://172.19.15.93:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://172.19.15.93:2379"
ETCD_INITIAL_CLUSTER="etcd1=http://172.19.15.92:2380,etcd2=http://172.19.15.93:2380,etcd3=http://172.19.15.94:2380"
启动etcd cluster
[root@k8s ~]# systemctl start etcd.service
[root@k8s ~]# systemctl status etcd.service -l
● etcd.service - Etcd Server
Loaded: loaded (/usr/lib/systemd/system/etcd.service; enabled; vendor preset: disabled)
Active: active (running) since 二 2018-07-03 18:13:06 CST; 16h ago
Main PID: 2085 (etcd)
Tasks: 31
Memory: 328.4M
CGroup: /system.slice/etcd.service
└─2085 /usr/bin/etcd --name=etcd1 --data-dir=/var/lib/etcd/default.etcd --listen-client-urls=http://172.19.15.92:2379,http://127.0.0.1:2379
查看etcd集群状态
[root@k8s ~]# etcdctl cluster-health
member 8c24796af2c20350 is healthy: got healthy result from http://172.19.15.94:2379
member e66597512233d97d is healthy: got healthy result from http://172.19.15.93:2379
member edfc36869b54e803 is healthy: got healthy result from http://172.19.15.92:2379
cluster is healthy
Kubernetes集群配置
master节点配置
1.apiserver配置文件修改,注意KUBE_ADMISSION_CONTROL选项的参数配置
[root@k8s ~]# cat /etc/kubernetes/apiserver
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--port=8080"
KUBELET_PORT="--kubelet-port=10250"
KUBE_ETCD_SERVERS="--etcd-servers=http://172.19.15.92:2379,http://172.19.15.93:2379,http://172.19.15.94:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,ResourceQuota"
KUBE_API_ARGS=""
2.启动服务
[root@k8s ~]# systemctl start kube-apiserver
[root@k8s ~]# systemctl start kube-controller-manager
[root@k8s ~]# systemctl start kube-scheduler
[root@k8s ~]# systemctl enable kube-apiserver
[root@k8s ~]# systemctl enable kube-controller-manager
[root@k8s ~]# systemctl enable kube-scheduler
nodes节点配置
[root@k8s-node1 ~]# cat /etc/kubernetes/config
KUBE_LOGTOSTDERR="--logtostderr=true"
KUBE_LOG_LEVEL="--v=0"
KUBE_ALLOW_PRIV="--allow-privileged=false"
KUBE_MASTER="--master=http://172.19.15.92:8080"
2.配置kubelet
[root@k8s-node1 ~]# cat /etc/kubernetes/kubelet
KUBELET_ADDRESS="--address=127.0.0.1"
KUBELET_HOSTNAME="--hostname-override=172.19.15.93"
KUBELET_API_SERVER="--api-servers=http://172.19.15.92:8080"
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
KUBELET_ARGS=""
3.docker service配置文件
[root@k8s-node1 ~]# cat /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target firewalld.service [Service]
Type=notify
Environment="http_proxy=http://192.168.59.241:8888/" "https_proxy=https://192.168.59.241:8888/"
ExecStart=/usr/bin/dockerd --registry-mirror=http://f2d6cb40.m.daocloud.io --bip=192.100.90.1/24
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process [Install]
WantedBy=multi-user.target
网络配置
在节点上进行配置flannel
[root@k8s-node1 ~]# cat /etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS="http://172.19.15.92:2379,http://172.19.15.93:2379,http://172.19.15.94:2379"
FLANNEL_ETCD_PREFIX="/k8s/network"
FLANNEL_OPTIONS="--logtostderr=true --log_dir=/var/log/k8s/flannel/ --etcd-prefix=/k8s/network --etcd-endpoints=http://172.19.15.92:2379,http://172.19.15.93:2379,http://172.19.15.94:2379 --iface=ens160"
master 节点需要配置 etcd 网络:
etcdctl set /k8s/network/config '{"Network":"192.100.0.1/16"}'
2.启动服务
[root@k8s-node1 ~]# systemctl start kubelet
[root@k8s-node1 ~]# systemctl start docker
[root@k8s-node1 ~]# systemctl start flanneld
[root@k8s-node1 ~]# systemctl enable kubelet
[root@k8s-node1 ~]# systemctl enable docker
[root@k8s-node1 ~]# systemctl enable flanneld
查看集群状态
[root@k8s ~]# kubectl get nodes
NAME STATUS AGE
172.19.15.92 Ready 16h
172.19.15.93 Ready 1d
172.19.15.94 Ready 1d
[root@k8s ~]# etcdctl member list
8c24796af2c20350: name=etcd3 peerURLs=http://172.19.15.94:2380 clientURLs=http://172.19.15.94:2379 isLeader=false
e66597512233d97d: name=etcd2 peerURLs=http://172.19.15.93:2380 clientURLs=http://172.19.15.93:2379 isLeader=false
edfc36869b54e803: name=etcd1 peerURLs=http://172.19.15.92:2380 clientURLs=http://172.19.15.92:2379 isLeader=true
[root@k8s ~]# etcdctl cluster-health
member 8c24796af2c20350 is healthy: got healthy result from http://172.19.15.94:2379
member e66597512233d97d is healthy: got healthy result from http://172.19.15.93:2379
member edfc36869b54e803 is healthy: got healthy result from http://172.19.15.92:2379
cluster is healthy
更改 docker 网段为 flannel 分配的网段
# export FLANNEL_SUBNET=10.254.26.1/24
# cat << EOF > /etc/docker/daemon.json
{
"bip" : "$FLANNEL_SUBNET"
}
EOF
# systemctl daemon-reload
# systemctl restart docker
Kubernetes 集群安装部署的更多相关文章
- Kubernetes集群的部署方式及详细步骤
一.部署环境架构以及方式 第一种部署方式 1.针对于master节点 将API Server.etcd.controller-manager.scheduler各组件进行yum install.编译安 ...
- 在 Kubernetes 集群快速部署 KubeSphere 容器平台
KubeSphere 不仅支持部署在 Linux 之上,还支持在已有 Kubernetes 集群之上部署 KubeSphere,自动纳管 Kubernetes 集群的已有资源与容器. 前提条件 Kub ...
- K8S集群安装部署
K8S集群安装部署 参考地址:https://www.cnblogs.com/xkops/p/6169034.html 1. 确保系统已经安装epel-release源 # yum -y inst ...
- HBase集群安装部署
0x01 软件环境 OS: CentOS6.5 x64 java: jdk1.8.0_111 hadoop: hadoop-2.5.2 hbase: hbase-0.98.24 0x02 集群概况 I ...
- flink部署操作-flink standalone集群安装部署
flink集群安装部署 standalone集群模式 必须依赖 必须的软件 JAVA_HOME配置 flink安装 配置flink 启动flink 添加Jobmanager/taskmanager 实 ...
- HBase 1.2.6 完全分布式集群安装部署详细过程
Apache HBase 是一个高可靠性.高性能.面向列.可伸缩的分布式存储系统,是NoSQL数据库,基于Google Bigtable思想的开源实现,可在廉价的PC Server上搭建大规模结构化存 ...
- 1.Hadoop集群安装部署
Hadoop集群安装部署 1.介绍 (1)架构模型 (2)使用工具 VMWARE cenos7 Xshell Xftp jdk-8u91-linux-x64.rpm hadoop-2.7.3.tar. ...
- 2 Hadoop集群安装部署准备
2 Hadoop集群安装部署准备 集群安装前需要考虑的几点硬件选型--CPU.内存.磁盘.网卡等--什么配置?需要多少? 网络规划--1 GB? 10 GB?--网络拓扑? 操作系统选型及基础环境-- ...
- 【分布式】Zookeeper伪集群安装部署
zookeeper:伪集群安装部署 只有一台linux主机,但却想要模拟搭建一套zookeeper集群的环境.可以使用伪集群模式来搭建.伪集群模式本质上就是在一个linux操作系统里面启动多个zook ...
随机推荐
- Spring Cloud Eureka的基础架构
基础架构 服务注册中心:Eureka提供的服务端,提供服务注册于发现的功能,也就是在上一节中我们实现的eureka-server 服务提供者:提供服务的应用,可以是springBoot应用,也可以是其 ...
- VS2010生成的文件在别的机器上运行提示“丢失MSVCR100D.dll”<转>
用vs2010编写的程序经常会发生的一个问题.在自己的机器上运行的好好的,但是在别的机器上就会发生没有找到MSVCR100D.dll.这是 个很头疼的问题.对于一些代码量几百行的小程序,我不可能要求其 ...
- archlinux错误:无法提交处理 (无效或已损坏的软件包)
1.首先更新一下密钥,如果没有安装archlinux-keyring,请及时安装 sudo pacman-key --refresh-keys 2.重新加载相应的签名密钥 sudo pacman-ke ...
- 在 Ruby 中执行 Shell 命令的 6 种方法
我们时常会与操作系统交互或在 Ruby 中执行 Shell 命令.Ruby为我们提供了完成该任务的诸多方法. Exec Kernel#exec 通过执行给定的命令来替换当前进程,例如: $ irb & ...
- RNA-Seq differential expression analysis: An extended review and a software tool RNA-Seq差异表达分析: 扩展评论和软件工具
RNA-Seq differential expression analysis: An extended review and a software tool RNA-Seq差异表达分析: 扩展 ...
- 职责链模式c#(处理车)
using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace 职责链模式{ ...
- Java程序设计17——多线程-Part-C
11 使用管道流 前面介绍的两种方式与其称为线程之间的通信,还不如称为线程之间协调运行的控制策略.如果需要在两条线程之间进行更多的信息交互,则可以考虑使用管道流进行通信. 管道流有3中存在形式:Pip ...
- 479. Largest Palindrome Product
class Solution { public: int largestPalindrome(int n) { vector<,,,,,,,}; ]; } }; 这里的穷举法,你不得不服
- WebApi参数传递总结(转)
出处:http://www.cnblogs.com/Juvy/p/3903974.html 在WebAPI中,请求主体(HttpContent)只能被读取一次,不被缓存,只能向前读取的流. 举例子说明 ...
- java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)
这个问题是说明你的JDBC数据库连接位置出错了,请仔细检查 private static String url; private static String username; private sta ...