環(huán)境準(zhǔn)備
- etcd
- kube-master
- kube-node-1
- kube-node-2
- kube-node-3
- 修改hostname和hosts
hostnamectl set-hostname etcd
192.168.221.129 etcd
192.168.221.128 kube-master
192.168.221.131 kube-node-1
192.168.221.132 kube-node-2
192.168.221.133 kube-node-3
Etcd運(yùn)行
curl -L https://github.com/coreos/etcd/releases/download/v3.1.0-alpha.1/etcd-v3.1.0-alpha.1-[Linux](http://lib.csdn.net/base/linux)-amd64.tar.gz -o etcd-v3.1.0-alpha.1-[linux](http://lib.csdn.net/base/linux)-amd64.tar.gz
tar zxvf etcd-v3.1.0-alpha.1-linux-amd64.tar.gz
cd etcd-v3.1.0-alpha.1-linux-amd64/
cp etcd /usr/bin/etcd
cp etcdctl /usr/bin/etcdctl
etcd -name etcd \
-data-dir /var/lib/etcd \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-advertise-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
>> /var/log/etcd.log 2>&1 &
檢查狀態(tài)
etcdctl -C http://etcd:4001 cluster-health
Kubernetes master
https://dl.k8s.io/v1.7.4/kubernetes-server-linux-amd64.tar.gz
wget https://dl.k8s.io/v1.7.4/kubernetes-server-linux-amd64.tar.gz
tar zxvf kubernetes-server-linux-amd64.tar.gz
cd kubernetes/server/bin/
find ./ -perm 755 | xargs -i cp {} /usr/bin/
Kubernetes API Server
kube-apiserver \
--logtostderr=true --v=0 \
--etcd_servers=http://etcd:4001 \
--insecure-bind-address=0.0.0.0 --insecure-port=8080 \
--service-cluster-ip-range=10.254.0.0/16 \
>> /var/log/kube-apiserver.log 2>&1 &
Kubernetes Controller Manager
kube-controller-manager \
--logtostderr=true --v=0 \
--master=http://kube-master:8080 \
>> /var/log/kube-controller-manager.log 2>&1 &
Kubernetes Scheduler
kube-scheduler \
--logtostderr=true --v=0 \
--master=http://kube-master:8080 \
>> /var/log/kube-scheduler.log 2>&1 &
Kubernetes Proxy
kube-proxy \
--logtostderr=true --v=0 \
--master=http://kube-master:8080 \
>> /var/log/kube-proxy.log 2>&1 &
Kubernetes node
docker
dockerd \
-H unix:///var/run/docker.sock -H 0.0.0.0:2375 \
>> /var/log/docker.log 2>&1 &
kubelet
kubelet \
--logtostderr=true --v=0 \
--cloud-config=/etc/kubernetes/kubelet \
--address=0.0.0.0 \
--api-servers=http://kube-master:8080 \
>> /var/log/kubelet.log 2>&1 &
Kubernetes Proxy
kube-proxy \
--logtostderr=true --v=0 \
--master=http://kube-master:8080 \
>> /var/log/kube-proxy.log 2>&1 &
查看狀態(tài)
kubectl -s http://kube-master:8080 get componentstatus
kubectl -s http://kube-master:8080 get node