k8s踩坑记第1篇--rc无法创建
六一快乐!!!
什么是k8s,我不想解释,百度资料有很多,本系列只踩坑,不科普。
问题描述:
做Hello World的例子,结果get pods一直显示没有资源?
应用配置代码:
1 | apiVersion : v1 |
创建rc
1 | kubectl create -f mysql-rc.yaml |
分析
创建了rc之后,虽然命令行提示成功了,但是pods一直没有创建,也检查了docker,mysql的镜像没有拉取。又仔细看了一边rc的结果,current和ready列的值是0,应该先解决current为0的问题。
google解决方案
- executed command :
openssl genrsa -out /tmp/serviceaccount.ket 2048
- modified the /etc/kubernetes/apiserver file to add following :
KUBE_API_ARGS=”–service_account_key_file=/tmp/serviceaccount.key”
- modified the /etc/kubernetes/controller-manager and add following:
KUBE_CONTROLLER_MANAGER_ARGS=”–service_account_private_key_file=/tmp/serviceaccount.key”
- restarted the kube-apiserver and kube-controller-manager services to restart the services
1
2service kube-apiserver restart
service kube-controller-manager restart
参考:
https://blog.csdn.net/jinzhencs/article/details/51435020
https://github.com/kubernetes/kubernetes/issues/11355#issuecomment-127378691