k8s安装与配置
一、k8s安装
最简单的安装方法是使用yum install kubernetes命令,但仍需修改各组件的启动参数,才能完成配置。
也可以下载二进制包,手动配置安装。
k8s master节点安装部署etcd,kube-apiserver,kube-controller-manager,kube-scheduler服务进程,我们使用kubectl作为客户端与master进行交互操作。在工作Node上仅需部署kubelet和kube-proxy服务进程。
此外,k8s还提供一个“all in one”的hyperkube程序来完成对以上服务程序的一键式启动。
hyperkube源码入口如下:
/cmd/hyperkube/main.go
// NewHyperKubeCommand is the entry point for hyperkube
func NewHyperKubeCommand(stopCh <-chan struct{}) (*cobra.Command, []func() *cobra.Command) {
// these have to be functions since the command is polymorphic. Cobra wants you to be top level
// command to get executed
apiserver := func() *cobra.Command {
ret := kubeapiserver.NewAPIServerCommand(stopCh)
// add back some unfortunate aliases that should be removed
ret.Aliases = []string{"apiserver"}
return ret
}
controller := func() *cobra.Command {
ret := kubecontrollermanager.NewControllerManagerCommand()
// add back some unfortunate aliases that should be removed
ret.Aliases = []string{"controller-manager"}
return ret
}
proxy := func() *cobra.Command {
ret := kubeproxy.NewProxyCommand()
// add back some unfortunate aliases that should be removed
ret.Aliases = []string{"proxy"}
return ret
}
scheduler := func() *cobra.Command {
ret := kubescheduler.NewSchedulerCommand()
// add back some unfortunate aliases that should be removed
ret.Aliases = []string{"scheduler"}
return ret
}
kubectlCmd := func() *cobra.Command { return kubectl.NewDefaultKubectlCommand() }
kubelet := func() *cobra.Command { return kubelet.NewKubeletCommand(stopCh) }
cloudController := func() *cobra.Command { return cloudcontrollermanager.NewCloudControllerManagerCommand() }
commandFns := []func() *cobra.Command{
apiserver,
controller,
proxy,
scheduler,
kubectlCmd,
kubelet,
cloudController,
}
可以看到启动了所有服务进程。待续.......
posted on 2018-06-08 22:10 sichenzhao 阅读(589) 评论(0) 编辑 收藏 举报