Kubernetes集群管理部署过程(centos7)

Kubernetes集群管理部署过程(centos7)

本文按照官网部署
详情参考http://kubernetes.io/v1.1/docs/getting-started-guides/centos/centos_manual_config.html

安装准备

  1. 两台相同的centos7主机分别命名为master, minion
  2. 配置静态IP地址,并且在hosts文件写入对应的地址解析
  3. 更换yum地址为国内源, ali 或者 163都可以
  4. 添加kubernetes源地址
    http://cbs.centos.org/repos/virt7-docker-common-testing/x86_64/os/
  5. 关闭firewall , selinux
  6. 更新系统软件包后重启机器

开始安装

两台机器均要安装

yum install kubernetes
yum install http://cbs.centos.org/kojifiles/packages/etcd/0.4.6/7.el7.centos/x86_64/etcd-0.4.6-7.el7.centos.x86_64.rpm

两台机器修改以下配置,编辑/etc/kubernetes/config

# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://master:4001"

# 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"

KUBE_MASTER="--master=http://master:8080"

在master机器修改, 编辑/etc/kubernetes/apiserver

# 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"


# How the replication controller and scheduler find the kube-apiserver
KUBE_MASTER="--master=http://master:8080"

# 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,ServiceAccount,ResourceQuota"

# Add your own!
KUBE_API_ARGS=""

启动服务

for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do 
    systemctl restart $SERVICES
    systemctl enable $SERVICES
done

在minion机器修改编辑 /etc/kubernetes/kubelet

# 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=minion"

# location of the api-server
KUBELET_API_SERVER="--api-servers=http://master:8080"

# Add your own!
KUBELET_ARGS=""

启动服务

for SERVICES in kube-proxy kubelet docker; do 
    systemctl restart $SERVICES
    systemctl enable $SERVICES
done

检查集群状态
在master机器上执行

[root@master ~]# kubectl get nodes
NAME      LABELS                          STATUS    AGE
minion    kubernetes.io/hostname=minion   Ready     14m
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值