您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“Kubernetes的安裝步驟”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Kubernetes的安裝步驟”吧!
Kubernetes安裝環(huán)境
Centos7.1系統(tǒng)的機(jī)器3臺
Master:192.168.0.120
Nodes:192.168.0.106, 192.168.0.107
=====
Master
=====
1 在Master上安裝kubernetes etcd flannel
yum install kubernetes etcd flannel -y
2 修改配置文件/etc/kubernetes/controller-manager
#指定key文件,key文件可以通過命令生成:openssl genrsa -out /etc/kubernetes/service.key 2048
KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file=/etc/kubernetes/service.key"
3 修改配置文件/etc/kubernetes/apiserver
# The address on the local server to listen to. 設(shè)為全部監(jiān)聽
KUBE_API_ADDRESS="--address=0.0.0.0"
# Comma separated list of nodes in the etcd cluster . 指定etcd節(jié)點的地址
KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.0.120:2379"
# Address range to use for services. 這個是設(shè)置今后運(yùn)行Service所在的ip網(wǎng)段
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=192.168.1.0/24"
# Add your own! 指定key文件
KUBE_API_ARGS="--service_account_key_file=/etc/kubernetes/service.key"
4 修改配置文件/etc/kubernetes/config
# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://192.168.0.120:8080"
5 修改配置文件/etc/etcd/etcd.conf
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.0.120:2379"
6 啟動etcd和kubernetes的服務(wù)
systemctl start etcd kube-apiserver kube-controller-manager kube-scheduler
systemctl enable etcd kube-apiserver kube-controller-manager kube-scheduler
7 修改配置文件/etc/sysconfig/flanneld
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD="http://192.168.0.120:2379"
# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_KEY="/atomic.io/network"
8 設(shè)置etcd config的值
# 創(chuàng)建一個文件內(nèi)容如下,Network指定的IP將為以后容器運(yùn)行的網(wǎng)段:
cat flannel-config.json
{
"Network":"172.16.0.0/16",
"SubnetLen":24,
"Backend":{
"Type":"vxlan",
"VNI":1
}
}
# 通過文件內(nèi)容來設(shè)置etc的config
etcdctl set atomic.io/network/config < flannel-config.json
9 啟動flannel服務(wù)
systemctl start flanneld
systemctl enable flanneld
到這里Master就安裝配置完畢,執(zhí)行下面命令可以查看master信息:
kubectl cluster-info
====
Nodes
====
每個節(jié)點上都要做如下的安裝配置,這里以107節(jié)點為例(已安裝docker為前提)
1 安裝kubernetes和flannel
yum -y install kubernetes flannel
2 修改/etc/kubernetes/config
KUBE_MASTER="--master=http://192.168.0.120:8080"
3 修改/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"
# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=node107.kuber.com"
# location of the api-server
KUBELET_API_SERVER="--api-servers=http://192.168.0.120:8080"
4 修改/etc/sysconfig/flanneld
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD="http://192.168.0.120:2379"
5 啟動flannel和kube相關(guān)服務(wù)
# 注意Node和Master上啟動的kube的服務(wù)是不一樣的
systemctl start flanneld kube-proxy kubelet
systemctl enable flanneld kube-proxy kubelet
# 重啟docker服務(wù)
systemctl restart docker
到此,Node節(jié)點配置完畢,可以在Master上執(zhí)行下面命令查看節(jié)點信息
kubectl get nodes
到此,相信大家對“Kubernetes的安裝步驟”有了更深的了解,不妨來實際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。