Kubernetes 1.11版本, 改動至關的大,主要是kubelet和yaml。node
RPMlinux |
包含命令web |
kubernetes-clientapi |
kubectltomcat |
kubernetes-masterapp |
kube-apiserver、kube-controller-manager、kube-scheduler、kube-version-changedom |
#master和node的命令都在這,client的就不要下載了webapp wget https://storage.googleapis.com/kubernetes-release/release/v1.11.0/kubernetes-server-linux-amd64.tar.gzide #啓動google export ETCDCTL_API=3 echo 'export ETCDCTL_API=3' >> /etc/profile rm -rf /tmp/etcd nohup etcd --listen-peer-urls http://0.0.0.0:7001 --listen-client-urls http://0.0.0.0:4001 --advertise-client-urls http://0.0.0.0:4001 --data-dir /tmp/etcd/ --name kubernetes_master &>> /var/log/kubernetes/kube-etcd.log &
nohup /root/kube_v1.11.0/kube-apiserver --insecure-bind-address=0.0.0.0 --insecure-port=8080 --secure-port=443 --etcd-servers=http://192.168.46.130:4001 --service-cluster-ip-range=10.1.0.0/16 --allow-privileged --logtostderr --admission-control=ServiceAccount --tls-cert-file=/root/kube_v1.11.0/ca_key/server.crt --tls-private-key-file=/root/kube_v1.11.0/ca_key/server.key --basic-auth-file=/root/kube_v1.11.0/ca_key/basic_auth.csv &>> /var/log/kubernetes/kube-apiserver.log &
nohup /root/kube_v1.11.0/kube-scheduler --master=127.0.0.1:8080 --logtostderr=true &>> /var/log/kubernetes/kube-scheduler.log &
nohup /root/kube_v1.11.0/kube-controller-manager --master=127.0.0.1:8080 --enable-hostpath-provisioner=true --logtostderr=true --root-ca-file=/root/kube_v1.11.0/ca_key/ca.crt --service-account-private-key-file=/root/kube_v1.11.0/ca_key/server.key &>> /var/log/kubernetes/kube-controller-manager.log & |
安裝同master
RPM |
包含命令 |
kubernetes-node |
kube-proxy、kubelet |
#kube-proxy、kubelet,能夠從master上拷貝便可 #啓動 #禁用swap swapoff -a vi /etc/fstab
# kubelet不在支持--api-servers,須要配置文件,非常麻煩,每一個node的kubeconfig,一致,拷貝便可 mkdir /etc/kubernetes/ TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/[:space:]" | dd bs=32 count=1 2>/dev/null) kubectl config --kubeconfig=/etc/kubernetes/kubeconfig use-context service-account-context kubectl config --kubeconfig=/etc/kubernetes/kubeconfig set-credentials kubelet --token=${TOKEN} kubectl config --kubeconfig=/etc/kubernetes/kubeconfig set-cluster local --server=http://192.168.46.130:8080 --certificate-authority=/root/kube_v1.11.0/ca_key/ca.crt
nohup /root/kube_v1.11.0/kubelet --address=0.0.0.0 --hostname-override=192.168.46.130 --cluster-dns=192.168.46.130 --enable-server=true --port=10250 --cluster-domain=perofu.com --allow-privileged=true --cadvisor-port=4194 --pod-infra-container-image=www.perofu.com:7070/google_containers/pause-amd64:3.0 --v=2 --cert-dir=/root/kube_v1.11.0/ca_key/ --kubeconfig=/etc/kubernetes/kubeconfig --cgroup-driver=cgroupfs --logtostderr=true &>> /var/log/kubernetes/kubelet.log &
nohup /root/kube_v1.11.0/kube-proxy --master=192.168.46.130:8080 --logtostderr=true --hostname-override=192.168.46.130 &>> /var/log/kubernetes/kube-proxy.log & |
一、kube-scheduler啓動要使用配置文件,能夠不用,僅是告警而已
##
WARNING: all flags other than --config, --write-config-to,
and --cleanup are deprecated. Please begin using a config file ASAP.
二、kubernetesV1.9 開始,kubelet已經不支持--api-servers參數,
須要指定--kubeconfig=/etc/kubernetes/kubeconfig配置文件來指明master的地址,
不然master主機執行kubectl get nodes,會提示找不到節點
三、node節點要關閉swap
Kubernetes v1.8以後,要求關閉系統Swap
swapoff -a
四、yaml的掛載
Path: /usr/local/tomcat/webapps/examples/
改成:小寫了
path: /usr/local/tomcat/webapps/examples/
四、yaml的port:【端口不能使用引號,會被認爲是字符串】
ports:
- containerPort: 8080
hostPort: 20080