# 编辑配置文件 vim /etc/kubernetes/apiserver # 配置信息如下 KUBE_API_ADDRESS="--insecure-bind-address=192.168.1.108" # The port on the local server to listen on. KUBE_API_PORT="--insecure-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.1.108: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=""
启动 master
1 2 3 4 5 6 7 8 9
systemctl start kube-apiserver systemctl start kube-controller-manager systemctl start kube-scheduler systemctl enable kube-apiserver systemctl enable kube-controller-manager systemctl enable kube-scheduler systemctl status kube-apiserver systemctl status kube-controller-manager systemctl status kube-scheduler
# 编辑配置文件 vim /etc/kubernetes/kubelet # 配置如下 KUBELET_ADDRESS="--address=192.168.1.139" # 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-1-139" # location of the api-server KUBELET_API_SERVER="--api_servers=http://192.168.1.108:8080" # Add your own! KUBELET_ARGS="--pod-infra-container-image=docker.io/kubernetes/pause:latest"
# 编辑配置文件 vim /etc/kubernetes/config # 配置样例如下 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.1.108:8080"
最后启动测试
1 2 3 4 5 6 7 8 9 10 11 12
# 启动 systemctl start kubelet systemctl start kube-proxy systemctl enable kubelet systemctl enable kube-proxy systemctl status kubelet systemctl status kube-proxy # 回到 108 master 测试 kubectl --server="http://192.168.1.108:8080" get node # 显示如下 NAME STATUS AGE 192-168-1-139 Ready 53s