就想多学学罢了
准备环境:
centos7 master 8GB 172.26.130.204
centos7 node 8GB 172.26.130.205
yum源就阿里源就好。。。
etcd:提供分布式数据存储的数据库吧,用于持久化存储k8s集群的配置和状态。
kube-apiserver:api service提供了httprest接口,是整个集群的入口,K8s其它组件之间不直接通信,而是通过API server通信的。
kube-scheduler:scheduler负责资源的调度。
kube-controller-manager:整个集群的管理控制中心,此组件里面是由多个控制器组成的,如:Replication Manager(管理ReplicationController 资源),ReplicaSet Controller,PersistentVolume controller。主要作用用来复制组件、追踪工作结点状态、处理失败结点
flannel:好像是用来支持网络通信的吧
kube-proxy:用来负载均衡网络流量
kubelet:用来管理node节点机上的容器
docker:运行项目镜像容器的组件
yum -y install epel-release
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
#查看防火墙状态
firewall-cmd --state
yum -y install etcd kubernetes-master
#[Member]
...
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
...
...
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
...
...
ETCD_NAME="default"
...
...
#[Clustering]
#ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
# The address on the local server to listen to.
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
# The port on the local server to listen on.
KUBE_API_PORT="--port=8080"
# Port minions listen on
KUBELET_PORT="--kubelet-port=10250"
# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://127.0.0.1:2379"
# Address range to use for services
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
# default admission control policies
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"
命令略
etcdctl set /atomic.io/network/config '{"NETWORK":"172.17.0.0/16"}'
》》》》》》》》》》》》》》》》》以上master主机上的配置安装什么的都弄完了》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
yum -y install flannel kubernetes-node
# Flanneld configuration options
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://172.26.130.204:2379"
# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/atomic.io/network"
###
# 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://172.26.130.204:8080"
###
# 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=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
KUBELET_HOSTNAME="--hostname-override=172.26.130.205"
# location of the api-server
KUBELET_API_SERVER="--api-servers=http://172.26.130.204: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=""
命令略
》》》》》》以上所有master主机,node节点机上的配置就完成了,接下来看看k8s集群是否搭建起来了》》》》》》》》》》》》》》》》》》》
在master主机上172.26.130.204执行如下命令,查看运行的node节点机器:
[root@fcphost ~]# kubectl get nodes
NAME STATUS AGE
172.26.130.205 Ready 31m
手机扫一扫
移动阅读更方便
你可能感兴趣的文章