关于创建rc和pod出现的问题

  • 1:no resource found

    解决办法

    	vim /etc/kubernetes/apiserver
    

    找到KUBE_ADMISSION_CONTROL=这一行,去掉ServiceAccount,保存退出。 重启kube-apiservice服务即可

  • 2:使用kubectl get pod命令查看pod时出现状态不对。

    	$ kubectl get pod
    	NAME          READY     STATUS              RESTARTS   AGE
    	mysql-j553h   0/1       ContainerCreating   0          1h
    

    此时状态ContainerCreating是不正常的,应该是running。 按网上解决方法执行以下命令,会报找不到文件或文件夹

    	$ yum update
    	$ yum install python-rhsm-certificates
    	$ docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
    	/etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory. 
    

    感觉又跳进了一个坑,网上查了下说使用vpn下载镜像就可以解决(没试过),那没vpn的可以进行以下操作,首先把自己的镜像源更改成国内的

    	vim /etc/docker/daemon.json
    	修改
    	 {
    	   "registry-mirrors": ["镜像地址(阿里加速器,自行申请)"]
    	 }
    	$ sudo systemctl daemon-reload
    	$ sudo systemctl restart docker
    

    然后更新yum,手动安装rhsm和pod-infrastructure,

    	$ yum update
    	$ yum search rhsm #搜索一下
    	$ yum install python-rhsm-certificates
    	$ docker search pod-infrastructure #搜索一下国内源,有些下不了,找那些带有ok的下
    	INDEX       NAME                                                DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
    	docker.io   docker.io/openshift/origin-pod         The pod infrastructure image for OpenShift 3    8                    
    	docker.io   docker.io/davinkevin/podcast-server    Container around the Podcast-Server Applic...   5                    
    	docker.io   docker.io/infrastructureascode/aws-cli Containerized AWS CLI on alpine to avoid r...   4                    [OK]
    	docker.io   docker.io/newrelic/infrastructure      Public image for New Relic Infrastructure.      4                    
    	docker.io   docker.io/infrastructureascode/uwsgi   uWSGI application server                        2                    [OK]
    	docker.io   docker.io/infrastructureascode/serf    A tiny Docker image with HashiCorp Serf us...   1                    [OK]
    	docker.io   docker.io/mosquitood/k8s-rhel7-pod-infrastructure                                                   1                    
    	docker.io   docker.io/podigg/podigg-lc-hobbit      A HOBBIT dataset generator wrapper for PoDiGG   1                    [OK]
    	docker.io   docker.io/stefanprodan/podinfo         Kubernetes multi-arch pod info                  1                    
    	docker.io   docker.io/tianyebj/pod-infrastructure  registry.access.redhat.com/rhel7/pod-infra...   1                    
    	docker.io   docker.io/w564791/pod-infrastructure   latest                                          1                    
    	docker.io   docker.io/infrastructureascode/hello-world A tiny "Hello World" web server with a hea... 0                  [OK]
    	docker.io   docker.io/jqka/pod-infrastructure      redhat pod                                      0                    [OK]
    	docker.io   docker.io/ocpqe/hello-pod              Copy form docker.io/deshuai/hello-pod:latest    0                    
    

    我找了个

    	$ docker pull docker.io/jqka/pod-infrastructure
    

    把下载好的镜像标签该成registry.access.redhat.com/rhel7/pod-infrastructure:latest(刚才报错的那个名称)

    	$ docker tag docker.io/jqka/pod-infrastructure registry.access.redhat.com/rhel7/pod-infrastructure:latest
    

    重启

    	systemctl restart kubelet
    

    此时查看pods发现状态还是不对,莫急,可以把原来的rc删除,重新创建一个。 发现状态都正常了。

    新手学习,步步为坑,记,共勉之

    参考: 解决kubernetes启动容器时,容器一直是ContainerCreating不能running

猜你喜欢

转载自my.oschina.net/u/3805335/blog/1862467