Kubernetes(K8S)集群在centos7.4下创建

自己在搭Kubernetes(K8S)集群下遇到的坑写一点随笔。

本次采用192.168.60.21,192.168.60.22,192.168.60.23作为需要装的服务器。

master需要安装etcd, flannel,docker, kubernetes   192.168.60.21
yum –y install etcd
yum –y install flannel
yum –y install docker
yum –y install kubernetes
分支上安装flannel,docker,kubernetes 
yum –y install flannel
yum –y install docker
yum –y install kubernetes
在master上修改etcd的配置文件
vim /etc/etcd/etcd.conf
ETCD_NAME="default"
ETCD_LISTEN_CLIENT_URLS="http:// 192.168.60.21:2379,http://127.0.0.1:2379"
ETCD_ADVERTISE_CLIENT_URLS="http:// 192.168.60.21:2379"
启动
systemctl enable etcd.service
systemctl  start etcd.service
检查
[[email protected] ~]#etcdctl -C http:// 192.168.60.21:2379 cluster-health
member 8e9e05c52164694d is healthy: got healthy result from http://10.0.0.11:2379
cluster is healthy
主机配置kube-controller-manager
编写/usr/lib/systemd/system/kube-controller.service文件。
Description=Kubernetes Controller Manager
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
 
[Service]
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/controller-manager
ExecStart=/usr/bin/kube-controller-manager \
                  $KUBE_LOGTOSTDERR \
                  $KUBE_LOG_LEVEL \
                  $KUBE_MASTER \
                  $KUBE_CONTROLLER_MANAGER_ARGS
Restart=on-failure
LimitNOFILE=65536
 
[Install]
WantedBy=multi-user.target
 
将/usr/lib/systemd/system下和/etc/kubernetes下的文件将里面的ip地址配成192.168.60.21
启动
for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler kube-proxy kubelet flanneld; do
    systemctl restart $SERVICES
    systemctl enable $SERVICES
    systemctl status $SERVICES
done
分支上192.168.60.22上
修改config文件vim /etc/kubernetes/config
###
# kubernetes system config
#
# The following values are used to configure various aspects of all
# kubernetes services, including
#
#   kube-apiserver.service
#   kube-controller-manager.service
#   kube-scheduler.service
#   kubelet.service
#   kube-proxy.service
# logging to stderr means we get it in the systemd journal
KUBE_LOGTOSTDERR="--logtostderr=true"
# journal message level, 0 is debug
KUBE_LOG_LEVEL="--v=0"
# Should this cluster be allowed to run privileged docker containers
KUBE_ALLOW_PRIV="--allow-privileged=false"
# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://192.168.60.21:8080"
KUBE_ETCD_SERVERS="--etcd_servers=http://192.168.60.21:2379"
修改kubelet
vim /etc/kubernetes/kubelet
###
# kubernetes kubelet (minion) config
# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=192.168.60.22"
# The port for the info server to serve on
# KUBELET_PORT="--port=10250"
# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=192.168.60.22"
# location of the api-server
KUBELET_API_SERVER="--api-servers=http://192.168.60.21:8080"
# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"
# Add your own!
KUBELET_ARGS=""
分支上192.168.60.23上类似
for SERVICES in kube-proxy kubelet flanneld; do
    systemctl restart $SERVICES
    systemctl enable $SERVICES
    systemctl status $SERVICES
done
检查
kubectl -s 192.168.60.21:8080 get all查看节点情况
至于为什么加上-s 192.168.60.21:8080呢,因为不佳时就报错,全网络也没有特别合适的解决方案参考https://www.cnblogs.com/lyq863987322/p/8516958.html,http://www.cnblogs.com/lyzw/p/6016789.html,https://jimmysong.io/posts/kubernetes-installation-on-centos/

原文地址:https://www.cnblogs.com/jueshixingkong/p/10188738.html

时间: 2024-10-12 04:28:17

Kubernetes(K8S)集群在centos7.4下创建的相关文章

Kubernetes(k8s)集群部署(k8s企业级Docker容器集群管理)系列之部署master/node节点组件(四)

0.前言 整体架构目录:ASP.NET Core分布式项目实战-目录 k8s架构目录:Kubernetes(k8s)集群部署(k8s企业级Docker容器集群管理)系列目录 1.部署master组件 master 服务器的组件有:kube-apiserver.kube-controller-manager.kube-scheduler 因此需要下载k8s master,下载地址:https://github.com/kubernetes/kubernetes/blob/master/CHANGE

kubernetes (K8S) 集群的搭建方式

kubernetes (K8S) 集群的搭建方式有两种: 守护进程模式和容器模式 (请注意看图,不一样的) 容器的编排管理工具,当然推荐使用容器来部署了.不过容器镜像是在 Google 云上的,需要各位各显神通了. container部署: systemd模式部署: 原文地址:https://www.cnblogs.com/liuxgcn/p/11154259.html

(二)搭建一个完成的Kubernetes/K8s集群v.1.16

单节点集群多节点集群 注意node通过连接loadbalancer 转发到mateter 的apiserver来进行运作的 集群规划: 角色 ip 组件 K8S-master1 192.168.0.101 kube-apiserver kube-controller-manager kube-scheduleretcd K8S-master2 192.168.0.102 kube-apiserver kube-controller-manager kube-scheduleretcd K8S-n

(一)Kubernetes/K8s 集群架构与组件

K8s相关概念:master/nodemaster Master 是 Cluster 的大脑,它的主要职责是调度,即决定将应用放在哪里运行,实现高可用,可以运行多个 Master.运行的相关组件:Kubernetes API Server(kube-apiserver),集群的统一入口,各组件协调者,以RESTful API提供接口服务,所有对象资源的增删改查和监听操作都交给APIServer处理后再提交给Etcd存储.Kubernetes Controller Manager,处理集群中常规后

kubernetes(k8s)集群安装calico

添加hosts解析 cat /etc/hosts 10.39.7.51 k8s-master-51 10.39.7.57 k8s-master-57 10.39.7.52 k8s-master-52 下载calico wget http://docs.projectcalico.org/v3.2/getting-started/kubernetes/installation/hosted/calico.yaml 下载所需镜像 # 建议下载后 推到自己的镜像仓库 [[email protected

k8s集群Canal的网络控制 原

1 简介 直接上干货 public class DispatcherServlet extends HttpServlet { private Properties contextConfigProperties = new Properties(); private List<String> classNames = new ArrayList<>(); private Map<String, Object> ioc = new HashMap<String,

centos7 k8s集群部署

安装k8s集群前期准备:网络环境:节点 主机名 ipMaster k8s_master 192.168.3.216Node1 k8s_node1 192.168.3.217Node2 k8s_node2 192.168.3.219 centos7版本:[[email protected]_master ~]# cat /etc/redhat-releaseCentOS Linux release 7.4.1708 (Core) 关闭firewalld:systemctl stop firewal

Kubernetes学习之路(一)之Kubeadm部署K8S集群

一个星期会超过多少阅读量呢??发布一篇,看看是否重新在51上写学习博文,有老铁支持嘛?? 使用kubeadm部署集群 节点名称 ip地址 部署说明 Pod 网段 Service网段 系统说明 k8s-master 192.168.56.11 docker.kubeadm.kubectl.kubelet 10.244.0.0/16 10.96.0.0/12 Centos 7.4 k8s-node01 192.168.56.12 docker.kubeadm.kubelet 10.244.0.0/1

kubernetes系列03—kubeadm安装部署K8S集群

1.kubernetes安装介绍 1.1 K8S架构图 1.2 K8S搭建安装示意图 1.3 安装kubernetes方法 1.3.1 方法1:使用kubeadm 安装kubernetes(本文演示的就是此方法) 优点:你只要安装kubeadm即可:kubeadm会帮你自动部署安装K8S集群:如:初始化K8S集群.配置各个插件的证书认证.部署集群网络等.安装简易. 缺点:不是自己一步一步安装,可能对K8S的理解不会那么深:并且有那一部分有问题,自己不好修正. 1.3.2 方法2:二进制安装部署k