您好,登錄后才能下訂單哦!
本篇內容主要講解“Kubernetes的安裝步驟”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“Kubernetes的安裝步驟”吧!
Kubernetes安裝環境
Centos7.1系統的機器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. 設為全部監聽
KUBE_API_ADDRESS="--address=0.0.0.0"
# Comma separated list of nodes in the etcd cluster . 指定etcd節點的地址
KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.0.120:2379"
# Address range to use for services. 這個是設置今后運行Service所在的ip網段
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的服務
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 設置etcd config的值
# 創建一個文件內容如下,Network指定的IP將為以后容器運行的網段:
cat flannel-config.json
{
"Network":"172.16.0.0/16",
"SubnetLen":24,
"Backend":{
"Type":"vxlan",
"VNI":1
}
}
# 通過文件內容來設置etc的config
etcdctl set atomic.io/network/config < flannel-config.json
9 啟動flannel服務
systemctl start flanneld
systemctl enable flanneld
到這里Master就安裝配置完畢,執行下面命令可以查看master信息:
kubectl cluster-info
====
Nodes
====
每個節點上都要做如下的安裝配置,這里以107節點為例(已安裝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相關服務
# 注意Node和Master上啟動的kube的服務是不一樣的
systemctl start flanneld kube-proxy kubelet
systemctl enable flanneld kube-proxy kubelet
# 重啟docker服務
systemctl restart docker
到此,Node節點配置完畢,可以在Master上執行下面命令查看節點信息
kubectl get nodes
到此,相信大家對“Kubernetes的安裝步驟”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。