Kubernetes集群部署文档
官网文档:https://kubernetes.io/docs/getting-started-guides/centos/centos_manual_config/
Kubernetes包提供了几个服务:kube-apiserver,kube-scheduler,kube-controller-manager,kubelet,kube-proxy。这些服务由systemd管理,配置文件位置:/etc/kubernetes。我们通过kubernetes实现跨主机。第一个主机,centos-master,将是Kubernetes管理。这个主机将运行kube-apiserver,kube-controller-manager和kube-scheduler,也将运行etcd。其余主机,centos-minion-n将是节点并运行kubelet,etcd,cadector和docker。
所有节点都运行flanneld作为网络覆盖。
准备环境:
准备三台centos7主机,请将主机IP替换为您的环境。
centos-master = 192.168.2.68
centos-minion = 192.168.2.78
禁用主节点和所有节点上的防火墙,因为docker与其他防火墙规则管理器不能很好地工作。CentOS不会让你禁用防火墙,只要SELinux强制,所以需要先禁用。
setenforce 0
vim /etc/selinux/config
SELINUX=disabled
systemctl disable iptables-services firewalld
systemctl stop iptables-services firewalld
官方配置centos的yum源为docker官方源,也可以不配置,使用默认的centos源
# vim /etc/yum.repos.d/virt7-docker-common-release.repo(所有主机上)
[virt7-docker-common-release]
name=virt7-docker-common-release
baseurl=http://cbs.centos.org/repos/virt7-docker-common-release/x86_64/os/
gpgcheck=0
配置主机名,也可以不配置,使用ip来管理
# vim /etc/hosts(所有主机上)
或
echo "192.168.2.68 centos-master
192.168.2.78 centos-minion" >> /etc/hosts
安装
所有的主机通过yum安装下列服务,如果使用centos源,请将红色部分去掉。其实一样,装出来都是1.4.0+1.12.5
# yum -y install --enablerepo=virt7-docker-common-release etcd flannel kubernetes(所有主机上)
# yum -y install etcd flannel kubernetes
配置
#vim /etc/kubernetes/config(所有节点)
# 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 replication controller and scheduler find the kube-apiserver
KUBE_MASTER="--master=http://centos-master:8080"
# vim /etc/etcd/etcd.conf(master)
# [member]
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
#[cluster]
ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379"
Default可以改掉 dir也可以改会自动创建
# vim /etc/kubernetes/apiserver(master) 一定把多余的去掉,尤其是认证那块
# The address on the local server to listen to.
KUBE_API_ADDRESS="--address=0.0.0.0"
# The port on the local server to listen on.
KUBE_API_PORT="--port=8080"
# Port kubelets listen on
KUBELET_PORT="--kubelet-port=10250"
# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://centos-master:2379"
# Address range to use for services
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
# Add your own!
KUBE_API_ARGS=""
<!--[if !supportLists]-->· <!--[endif]-->警告此网络必须在网络基础设施中未使用!172.30.0.0/16在我们的网络是没有用过的
systemctl start etcd
etcdctl mkdir /kube-centos/network
etcdctl mk /kube-centos/network/config
"{ \"Network\": \"172.30.0.0/16\", \"SubnetLen\": 24, \"Backend\": { \"Type\": \"vxlan\" } }"
# vim /etc/sysconfig/flannel(master)
# Flanneld configuration options
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://centos-master:2379"
# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/kube-centos/network"
# Any additional options that you want to pass
#FLANNEL_OPTIONS=""
# vim /etc/kubernetes/kubelet(minion)
# The address for the info server to serve on
KUBELET_ADDRESS="--address=0.0.0.0"
# The port for the info server to serve on
KUBELET_PORT="--port=10250"
# You may leave this blank to use the actual hostname
# Check the node number!
KUBELET_HOSTNAME="--hostname-override=centos-minion-n"
# Location of the api-server
KUBELET_API_SERVER="--api-servers=http://centos-master:8080"
# Add your own!
KUBELET_ARGS=""
# vim /etc/sysconfig/flanneld(minion)
# Flanneld configuration options
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://centos-master:2379"
# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/kube-centos/network"
# Any additional options that you want to pass
#FLANNEL_OPTIONS=""
master 启动脚本
for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler flanneld; do systemctl restart $SERVICES systemctl enable$SERVICES systemctl status $SERVICES done
minion启动脚本
for SERVICES in kube-proxy kubelet flanneld docker; do
systemctl restart $SERVICES
systemctl enable$SERVICES
systemctl status $SERVICES
done
验证
$ kubectl get nodes
NAME LABELS STATUS
centos-minion <none> Ready
相关推荐
详细的K8S集群部署手册
在ubuntu 16.04下用二进制部署kubernetes v1.6.2集群-文档
k8s集群部署文档说明
搭建一个完整的K8S集群部署文档
helm部署应用到k8s集群(helm+k8s)——详细文档
k8s集群部署primetheus监控需要的全部配置文件,一键执行即可使用,包含了metrics、ingress、config等
适用于银河麒麟sever-V10操作系统 arm架构 k8s-v1.23.4版本 离线安装 包含k8s依赖项,组件镜像包,k8s-rpm包,yaml文件 安装过程word版
kubernetes 二进制部署
详细步骤请见文档,也可以参考kubernetes入门课本的第一章
k8s-helm-资料笔记-v3版部署k8s集群—超详细,超全面(带文档和相关软件包)
kubeadm部署高可用k8s集群,haproxy+keepalived-版本k8s1.20.4,详细笔记总结文档
K8s集群所有细节部署文档 内容简介: 1、组件版本和配置策略 2、系统初始化和全局变量 3、创建CA证书和密钥 4、部署kubectl命令行工具 5、部署etcd集群 6、部署flannel网络 7、部署master节点 8、部署woker节点 9、...
k8s边车喷油器使用Kubernetes中的MutatingAdmissionWebhook在资源创建时将辅助工具注入新的部署中这是什么? 在Tumblr,我们运行一些具有复杂的边车设置的容器。 kubernetes容器可以运行5个以上的其他容器,以及一些...
文档大小有限制,有个安装包kubernetes-server-linux-amd64.tar.gz实在是传不上去,大家自己找吧!
Rook 简化了 Ceph 在 Kubernetes 集群中的部署过程。 本教程基于rook1.8.1实现,已经过物理机、虚拟机、单硬盘osd、多硬盘osd、稳定性测试等多重验证。 本教程包含rook-ceph配置详解、部署、卸载、cephfs使用教程等
这文档我教新手如何部署k8s开源项目,里面详细给到大家。
分享课程——【2022】云原生Kubernetes全栈架构师:基于世界500强的k8s实战课程,2022年最新版,基于V1.23版本,完整版提供文档和软件下载! 课程适合人群: 1、准备学习k8s的运维、开发、测试、架构师; 2、k8s...
在K8s集群中部署的MongoDB Sharded集群 用于Shard和Config服务器的Pod的部署: 此处,分片副本集存储实际数据或块(文档集合),而配置服务器副本集存储mongodb集群的元数据和配置信息。 在k8s集群中,我们创建了...
根据阿良的二进制部署文档编写的,安装步骤请看readme.txt,给想学习k8s的小伙伴节省更多的搭建集群的时间,不懂的可以直接给我留言,欢迎大家一起讨论
JupyterHub Helm图表使用户可以在云环境中的Kubernetes集群上创建可复制且可维护的JupyterHub部署。 已发布的图表可在我们的。 历史 本文档的许多初始基础是从UC Berkeley的JupyterHub和Kubernetes在程序中的成功...