ubuntu 16.04下安裝kubernetes1.6(二)
4.3 安裝etcd
在master上安裝etcd,本文對應的是192.168.100.20這臺機器
下載etcd安裝包
wget
解包,將etcd-v3.2.7-linux-amd64下的etcd,etcdctl到/usr/local/bin目錄下
cp etcd-v3.2.7-linux-amd64/{etcd,etcdctl} /usr/local/bin
製作etcd啟動指令碼
cat etcd.sh
#!/bin/sh
ETCD_ADDR=
ETCD_DATA_DIR=/var/lib/etcd
ETCD_NAME=kubernetes
! test -d $ETCD_DATA_DIR && mkdir -p $ETCD_DATA_DIR
cat ? << EOF >/usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server
[Service]
ExecStart=/usr/local/bin/etcd --listen-client-urls='$ETCD_ADDR' --advertise-client-urls='$ETCD_ADDR'
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable etcd
systemctl start etcd
啟動etcd
systemctl start etcd.service
4.4 安裝apiserver,controller-manager,scheduler,kubectl
在master上安裝apiserver
apiserver,controller-manager,sheduler等元件都在kubernetes包中,所以下載kubernetes包即可
wget
解包,並將kubernetes/server/bin下的kube-apiserver,kube-controller-manager,kube-scheduler,kubectl,kubefed 複製到/usr/local/bin下
cp kubernetes/server/bin/{kube-apiserver,kube-controller-manager,kube-scheduler,kubectl,kubefed} /usr/local/bin
製作apiserver ,controller-manager,scheduler的啟動指令碼
apiserver 啟動指令碼
cat apiserver.sh
#!/bin/sh
KUBE_LOGTOSTDERR=true
KUBE_LOG_LEVEL=2
KUBE_ETCD_SERVERS=http://192.168.100.20:2379
KUBE_CLUSTER_IP=10.10.10.0/24
INSECURE_BIND_ADDR=0.0.0.0
INSECURE_PORT=8080
LOG_DIR=/var/log/kubernetes
cat</usr/lib/systemd/system/apiserver.service
[Unit]
Description=Kubernetes API Server
After=network.target
After=etcd.service
[Service]
ExecStart=/usr/local/bin/kube-apiserver \\
--logtostderr=${KUBE_LOGTOSTDERR} \\
--v=${KUBE_LOG_LEVEL} \\
--log-dir='${LOG_DIR}' \\
--etcd_servers=${KUBE_ETCD_SERVERS} \\
--service-cluster-ip-range=${KUBE_CLUSTER_IP} \\
--service-node-port-range=1-65535 \\
--admission_control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ResourceQuota \\
--insecure-bind-address=${INSECURE_BIND_ADDR} \\
--insecure-port=${INSECURE_PORT}
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable apiserver
systemctl start apiserver
啟動服務
systemctl start apiserver.service
controller-manager啟動指令碼
cat controller-mananger.sh
#!/bin/sh
KUBE_LOGTOSTDERR=true
KUBE_LOG_LEVEL=4kubernetes-server-linux-amd64.tar.gz
KUBE_MASTER=192.168.100.20:8080
cat </usr/lib/systemd/system/controller-manager.service
[Unit]
Description=Kubernetes Controller Manager
Documentation=
After=network.target
After=apiserver.service
[Service]
ExecStart=/usr/local/bin/kube-controller-manager \\
--logtostderr=${KUBE_LOGTOSTDERR} \\
--v=${KUBE_LOG_LEVEL} \\
--log-dir="/var/log/controller" \\
--master=${KUBE_MASTER} \\
--service-cluster-ip-range=10.10.10.0/24
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable controller-manager
systemctl start controller-manager
啟動服務
systemctl start controller-manager.service
scheduler啟動指令碼
cat scheduler.sh
#!bin/sh
KUBE_LOGTOSTDERR=true
KUBE_LOG_LEVEL=4
KUBE_MASTER=192.168.100.20:8080
cat ?</usr/lib/systemd/system/scheduler.service
[Unit]
Description=Kubernetes Scheduler
Documentation=
[Service]
ExecStart=/usr/local/bin/kube-scheduler \\
--logtostderr=${KUBE_LOGTOSTDERR} \\
--v=${KUBE_LOG_LEVEL} \\
--master=${KUBE_MASTER} \\
--log-dir='/var/log/scheduler'
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable scheduler
systemctl start scheduler
啟動服務systemctl start scheduler.service
4.5 安裝kubelet,kube-proxy
這兩個元件安裝在minion端,將在master下載的kubernetes-server-linux-amd64.tar.gz解壓後的kubernetes/server/bin下的kubelet,kube-proxy複製到minion的/usr/local/bin下
cp kubernetes/server/bin/{kubelet,kube-proxy} /usr/local/bin
製作啟動指令碼
kubelet啟動指令碼
cat kubelet.sh
#!/bin/sh
KUBE_LOGTOSTDERR=true
KUBE_LOG_LEVEL=4
KUBE_SERVERS=http://192.168.100.20:8080
MINION_HOSTNAME=192.168.100.93
cat ?</usr/lib/systemd/system/kubelet.service
[Unit]
Description=Kubernetes Kubelet
After=docker.socket cadvisor.service
Requires=docker.socket
[Service]
ExecStart=/usr/local/bin/kubelet \\
--logtostderr=${KUBE_LOGTOSTDERR} \\
--v=${KUBE_LOG_LEVEL} \\
--api_servers=${KUBE_SERVERS} \\
--hostname_override=${MINION_HOSTNAME} \\
--cluster-dns=10.10.10.10 \\
--cluster-domain=cluster.local \\
--allow-privileged=true \\
--pod-infra-container-image=registry:5000/pause-amd64:3.0
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable kubelet
systemctl start kubelet
啟動服務
systemctl start kubelet.service
kube-proxy啟動指令碼
cat proxy.sh
#!/bin/sh
KUBE_LOGTOSTDERR=true
KUBE_LOG_LEVEL=4
KUBE_SERVERS=http://192.168.100.20:8080
cat ?</usr/lib/systemd/system/proxy.service
[Unit]
Description=Kubernetes Proxy
# the proxy crashes if etcd isn't reachable.
# /issues/1206
After=network.target
[Service]
ExecStart=/usr/local/bin/kube-proxy \\
--logtostderr=${KUBE_LOGTOSTDERR} \\
--v=${KUBE_LOG_LEVEL} \\
--master=${KUBE_SERVERS}
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable proxy
systemctl start proxy
啟動服務systemctl start proxy.service
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27181165/viewspace-2145486/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ubuntu 16.04下安裝kubernetes1.6(一)Ubuntu
- ubuntu16.04 下安裝mysqlUbuntuMySql
- Ubuntu 16.04 下安裝配置caffeUbuntu
- ubuntu16.04 下kvm安裝Ubuntu
- UBuntu16.04下安裝Docker(親測)UbuntuDocker
- Ubuntu16.04下安裝gtsam-3.2.1Ubuntu
- ubuntu16.04下安裝NS3.27UbuntuS3
- ubuntu16.04系統下安裝dockerUbuntuDocker
- Ubuntu 16.04 安裝 EmacsUbuntuMac
- Vagrant 安裝ubuntu 16.04Ubuntu
- Ubuntu 16.04安裝NginxUbuntuNginx
- Ubuntu 16.04 安裝 RedisUbuntuRedis
- ubuntu16.04下的MySQL離線安裝UbuntuMySql
- Ubuntu 16.04 安裝 Mysql 8.0UbuntuMySql
- ubuntu16.04安裝rosUbuntuROS
- Ubuntu 16.04 上安裝 OrientDB!Ubuntu
- Ubuntu 16.04 安裝 JenkinsUbuntuJenkins
- ubuntu 16.04下安裝kubernetes 1.6之dashboardUbuntu
- ubuntu 16.04安裝LNMP環境UbuntuLNMP
- 安裝kalibr Ubuntu16.04Ubuntu
- Ubuntu16.04安裝、使用typoraUbuntu
- Ubuntu 16.04 安裝VSCodeUbuntuVSCode
- ubuntu16.04 CUDA, CUDNN 安裝UbuntuDNN
- Ubuntu 16.04 上安裝 MySQL 5.7UbuntuMySql
- Ubuntu 16.04下安裝資料庫Oracle客戶端Ubuntu資料庫Oracle客戶端
- Ubuntu 16.04 安裝Google 瀏覽器UbuntuGo瀏覽器
- VM中的Ubuntu(16.04)安裝tenserflowUbuntu
- Ubuntu 16.04 安裝Nvidia驅動Ubuntu
- Ubuntu 16.04 安裝 Tensorflow Gpu版本UbuntuGPU
- Ubuntu 16.04安裝RabbitMQ(單機版)UbuntuMQ
- ubuntu 16.04 64bit安裝 JuliaUbuntu
- Ubuntu 16.04 安裝 Gnome 桌面環境Ubuntu
- Ubuntu 16.04下安裝Oracle資料庫的ODBC驅動UbuntuOracle資料庫
- Ubuntu 16.04下 Mysql5.7.17原始碼編譯與安裝UbuntuMySql原始碼編譯
- ubuntu 16.04 下安裝kubernetes 1.6 之kube-dnsUbuntuDNS
- Ubuntu16.04雙系統安裝及解除安裝Ubuntu
- Ubuntu 16.04 安裝 MySQL 8.0 全過程UbuntuMySql
- ubuntu16.04安裝Tomact8UbuntuMac