3、k8s master
#############kube-apiserver
cp kube-apiserver /usr/bin
chmod 755 /usr/bin/kube-apiserver
mkdir -p /app/kubernetes/conf
mkdir -p /app/kubernetes/log
vi /usr/lib/systemd/system/kube-apiserver.service
[Unit]
Description=Kubernetes API Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=etcd.service
Wants=etcd.service
[Service]
EnvironmentFile=/app/kubernetes/conf/apiserver
ExecStart=/usr/bin/kube-apiserver $KUBE_API_ARGS
Restart=on-failure
Type=notify
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
vi /app/kubernetes/conf/apiserver
KUBE_API_ARGS="--etcd-servers=http://127.0.0.1:2379 --insecure-bind-address=0.0.0.0 --insecure-port=8080 --service-cluster-ip-range=10.254.0.0/16 --service-node-port-range=1-65535 --admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota --logtostderr=false --log-dir=/app/kubernetes/log --v=2"
# --admission-control= 参数是准入控制 具体意思参考
http://blog.csdn.net/yan234280533/article/details/76320414
如果deployment发布出去,node收不到,可能是此控制限制,可以删除--admission-control=
systemctl daemon-reload
systemctl enable kube-apiserver.service
systemctl start kube-apiserver.service
systemctl status kube-apiserver.service
#############kube-controller-manager
cp kube-controller-manager /usr/bin
chmod 755 /usr/bin/kube-controller-manager
vi /usr/lib/systemd/system/kube-controller-manager.service
[Unit]
Description=Kubernetes Controller Manager
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=kube-apiserver.service
Requires=kube-apiserver.service
[Service]
EnvironmentFile=/app/kubernetes/conf/controller-manager
ExecStart=/usr/bin/kube-controller-manager $KUBE_CONTROLLER_MANAGER_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
vi /app/kubernetes/conf/controller-manager
KUBE_CONTROLLER_MANAGER_ARGS="--master=http://127.0.0.1:8080 --logtostderr=false --log-dir=/app/kubernetes/log --v=2"
systemctl daemon-reload
systemctl enable kube-controller-manager.service
systemctl start kube-controller-manager.service
systemctl status kube-controller-manager.service
#############kube-scheduler
cp kube-scheduler /usr/bin/
chmod 755 /usr/bin/kube-scheduler
vi /usr/lib/systemd/system/kube-scheduler.service
[Unit]
Description=Kubernetes Scheduler
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=kube-apiserver.service
Requires=kube-apiserver.service
[Service]
EnvironmentFile=/app/kubernetes/conf/scheduler
ExecStart=/usr/bin/kube-scheduler $KUBE_SCHEDULER_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
vi /app/kubernetes/conf/scheduler
KUBE_SCHEDULER_ARGS="--master=http://127.0.0.1:8080 --logtostderr=false --log-dir=/app/kubernetes/log --v=2"
systemctl daemon-reload
systemctl enable kube-scheduler.service
systemctl start kube-scheduler.service
systemctl status kube-scheduler.service
#安装后发现kubectl 没法使用报错,参考http://blog.csdn.net/huangfei711/article/details/53044539
[root@master /]# kubectl
-bash: kubectl: 未找到命令
server压缩包里有此文件,解决kubectl未找到问题
cp kubectl /usr/bin
chmod 755 /usr/bin/kubectl
source ~/.bash_profile
kubectl -s http://127.0.0.1:8080 get componentstatus
kubectl -s http://127.0.0.1:8080 get node