kubernetes分散式
一、kubernetes簡介
Kubernetes 是Google開源的容器叢集管理系統,基於Docker構建一個容器的排程服務,提供資源排程、均衡容災、服務註冊、動態擴縮容等功能套件,目前最新版本為1.1.1。本文介紹如何基於Centos7構建Kubernetes平臺。
二、架構環境
系統:Centos7
網路配置: kubernetes_master-192.168.122.207
kubernetes_etcd-192.168.122.196
kubernetes_nodes-192.168.122.131
應用:kubernetes + etcd + docker
三、kubernetes_etcd安裝etcd並升級
#yum install -y etcd
#wget
#tar zxvf etcd-v2.3.0-alpha.0-linux-amd64.tar.gz
#cd etcd-v2.3.0-alpha.0-linux-amd64
#cp etcd* /usr/local/bin
#systemctl start etcd.service
#systemctl enable etcd.service
四、配置etcd(改動標紅)
#vim /etc/etcd/etcd.conf
# [member]
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
#ETCD_SNAPSHOT_COUNTER="10000"
#ETCD_HEARTBEAT_INTERVAL="100"
#ETCD_ELECTION_TIMEOUT="1000"
#ETCD_LISTEN_PEER_URLS=""
ETCD_LISTEN_CLIENT_URLS="http://192.168.122.196:2379"
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
#ETCD_CORS=""
#[cluster]
#ETCD_INITIAL_ADVERTISE_PEER_URLS=""
# if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test="
#ETCD_INITIAL_CLUSTER="default="
#ETCD_INITIAL_CLUSTER_STATE="new"
#ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.122.196:2379"
#ETCD_DISCOVERY=""
#ETCD_DISCOVERY_SRV=""
#ETCD_DISCOVERY_FALLBACK="proxy"
#ETCD_DISCOVERY_PROXY=""
#[proxy]
#ETCD_PROXY="off"
#[security]
#ETCD_CERT_FILE=""
#ETCD_KEY_FILE=""
#ETCD_CLIENT_CERT_AUTH="false"
#ETCD_TRUSTED_CA_FILE=""
#ETCD_PEER_CERT_FILE=""
#ETCD_PEER_KEY_FILE=""
#ETCD_PEER_CLIENT_CERT_AUTH="false"
#ETCD_PEER_TRUSTED_CA_FILE=""
#[logging]
#ETCD_DEBUG="false"
# examples for -log-package-levels etcdserver=WARNING,security=DEBUG
五、kubernetes_master安裝kubernetes並升級
#yum install -y kubernetes
#wget
#tar zxvf kubernetes.tar.gz
#cd kubernetes
#tar zxf kubernetes/server/kubernetes-server-linux-amd64.tar.gz
#cp kubernetes/server/kube* /usr/bin
六、配置kubernetes_master(改動標紅)
#vim /etc/kubernetes/config
# 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://192.168.122.207:8080"
#vim /etc/kubernetes/apiserver
# kubernetes system config
# The following values are used to configure the kube-apiserver
# 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 minions listen on
# KUBELET_PORT="--kubelet_port=10250"
# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd_servers=http://192.168.122.196: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,ServiceAccount,ResourceQuota"
# Add your own!
KUBE_API_ARGS=""
vim /etc/kubernetes/controller-manager
# The following values are used to configure the kubernetes controller-manager
KUBELET_ADDRESSES="--machines= 192.168.122.131"
# defaults from config and apiserver should be adequate
# Add your own!
KUBE_CONTROLLER_MANAGER_ARGS=""
七、啟動服務
#systemctl start kube-apiserver.service kube-controller-manager.service kube-scheduler.service
#systemctl enable kube-apiserver.service kube-controller-manager.service kube-scheduler.service
八、kubernetes_nodes安裝kubernetes和docker並升級
#yum install -y kubernetes docker
#wget
#tar zxvf kubernetes.tar.gz
#cd kubernetes
#tar zxf kubernetes/server/kubernetes-server-linux-amd64.tar.gz
#cp kubernetes/server/kube* /usr/bin
九、配置kubernetes_nodes(改動標紅)
# 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=192.168.122.207"
# location of the api-server
KUBELET_API_SERVER="--api_servers=http://192.168.122.207:8080"
# Add your own!
KUBELET_ARGS=""
十、啟動kubernetes_nodes服務
#systemctl enable docker.service kubelet.service kube-proxy.service
#systemctl start docker.service kubelet.service
十一、測試連通性
#kubecel version
Client Version: version.Info{Major:"1", Minor:"0", GitVersion:"v1.0.1", GitCommit:"6a5c06e3d1eb27a6310a09270e4a5fb1afa93e74", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"0", GitVersion:"v1.0.1", GitCommit:"6a5c06e3d1eb27a6310a09270e4a5fb1afa93e74", GitTreeState:"clean"}
(證明apiserver以啟動)
#kubectl get nodes
NAME LABELS STATUS
192.168.122.207 kubernetes.io/hostname=192.168.122.207 Ready
(證明kubernetes_master和kubernetes_nodes連線成功)
十二、總結
拜讀了很多大牛的博文終於把最新的kubernetes分散式架構起來,期間太多的坑不言而喻,希望同行小夥伴們看到此篇博文能有一些啟發,後面還會有kubernetes分散式管理docker容器博文和大家分享,已達到拋磚引玉的效果。希望大牛路過指點一二,不勝感激。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18796236/viewspace-1841203/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 基於kubernetes的分散式限流分散式
- Longhorn,Kubernetes 雲原生分散式塊儲存分散式
- Kubernetes – Google分散式容器技術初體驗Go分散式
- 分散式快取綜合指南:Kubernetes + Redis + Spring Boot分散式快取RedisSpring Boot
- [分散式][分散式鎖]淺談分散式鎖分散式
- 在 Kubernetes 上快速測試 Citus 分散式 PostgreSQL 叢集(分散式表,共置,引用表,列儲存)分散式SQL
- Kubernetes中分散式儲存Rook-Ceph部署快速演練分散式
- JAVA 分散式 - 分散式介紹Java分散式
- ElasticDL: Kubernetes-native 彈性分散式深度學習系統AST分散式深度學習
- 案例 | 荔枝微課基於 kubernetes 搭建分散式壓測系統分散式
- kubernetes實踐之四十六:分散式負載測試Locust分散式負載
- 分散式之抉擇分散式鎖分散式
- 分散式事務和分散式hash分散式
- 分散式分散式
- 在Kubernetes上使用Spring Boot實現Hazelcast分散式快取 – PiotrSpring BootAST分散式快取
- [譯] Kubernetes 分散式應用部署和人臉識別 app 例項分散式APP
- 一鍵在本地搭建執行Istio 1.0的分散式Kubernetes叢集分散式
- 分散式 - 分散式系統的特點分散式
- 分散式系統(三)——分散式事務分散式
- 十九、Redis分散式鎖、Zookeeper分散式鎖Redis分散式
- jeesz分散式架構-分散式高可用分散式架構
- 從分散式計算到分散式訓練分散式
- 英特爾貢獻基於 Kubernetes 分散式深度學習平臺:Nauta分散式深度學習
- 分散式系列七: 分散式事務理論分散式
- [分散式][Redis]Redis分散式框架搭建與整合分散式Redis框架
- [分散式]分散式計算系統淺析分散式
- 分散式資料(4)分散式與版本化分散式
- Hadoop 分散式儲存分散式計算Hadoop分散式
- 分散式框架分散式框架
- 分散式-zookeeper分散式
- 分散式事物分散式
- 分散式base分散式
- 分散式2分散式
- 分散式限流分散式
- java分散式??Java分散式
- 分散式鎖分散式
- 分散式id分散式
- CentOS7 hadoop3.3.1安裝(單機分散式、偽分散式、分散式)CentOSHadoop分散式