- containerPort: 6379
kubernetes启动pod,pod状态一直不正常,查看pod状态显示
image pull failed for registry.access.redhat.com/rhel7/pod-infrastructure:latest, this may be because there are no credentials on this request. details: (open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory)
按照网上所说的解决方案:yum install *rhsm* -y
Failed to create pod infra container: ImagePullBackOff; Skipping pod "redis-master-jj6jw_default(fec25a87-cdbe-11e7-ba32-525400cae48b)": Back-off pulling image "registry.access.redhat.com/rhel7/pod-infrastructure:latest
解决方法:试试通过手动下载
docker pull registry.access.redhat.com/rhel7/pod-infrastructure:latest
docker pull 是还是报错
open /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt: no such file or directory
查看下redhat-ca.crt确实不存在,registry.access.redhat.com/rhel7/pod-infrastructure:latest默认是https下载。
最终解决方案:
1.docker search pod-infrastructure
docker search pod-infrastructure
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> 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.io docker.io/oudi/pod-infrastructure pod-infrastructure 0 [OK]
docker.io docker.io/sebastianhutter/podcaster python script to download podcasts https:/... 0 [OK]
docker.io docker.io/shadowalker911/pod-infrastructure 0
docker.io docker.io/statemood/pod-infrastructure Automated build from registry.access.redha... 0 [OK]
docker.io docker.io/tfgco/podium Podium is a blazing-fast player ranking se... 0
docker.io docker.io/trancong/pod2consul register pod with consul 0
docker.io docker.io/tundradotcom/podyn dockerized Podyn 0
docker.io docker.io/vistalba/podget Podget Docker with rename included. 0 [OK]
docker.io docker.io/wedeploy/infrastructure 0
docker.io docker.io/xplenty/rhel7-pod-infrastructure registry.access.redhat.com/rhel7/pod-infra... 0
docker.io docker.io/zengshaoyong/pod-infrastructure pod-infrastructure 0 [OK]
2.vi /etc/kubernetes/kubelet
替换为上面第一个节点(Deven:后面改回去了也没有报错了,所以这个步骤可能不是必须的。) KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=docker.io/openshift/origin-pod"
3.重启
systemctl restart kube-apiserver
systemctl restart kube-controller-manager
systemctl restart kube-scheduler
systemctl restart kubelet
systemctl restart kube-proxy
4. kubectl get pods 查看之前的pods已经正常状态Running
属于一个Pod的多个容器应用之间相互访问只需要通过localhost就可以通信,这一组容器被绑定在一个环境中。
使用kubectl create创建该Pod后,get pod信息可以看到如下图:
#kubectl get pods
NAME READY STATUS RESTARTS AGE
myweb-1rr24 1/1 Running 1 27m
redis-php 2/2 Running 0 16s
查看pod的详细信息,可以看到两个容器的定义和创建过程。
#kubectl describe pods redis-php
Name: redis-php
Namespace: default
Node: 192.168.1.247/192.168.1.247
Start Time: Sat, 04 Aug 2018 17:37:53 +0800
Labels: name=redis-php
Status: Running
IP: 10.1.49.3
Controllers:
Containers:
frontend:
Image> Port: 6379/TCP
State: Running
Started: Sat, 04 Aug 2018 17:38:00 +0800
Ready: True
Restart Count: 0
Volume Mounts:
Environment Variables:
Conditions:
Type Status
Initialized True
Ready True
PodScheduled True
No volumes.
QoS> Tolerations:
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
2m 2m 1 {default-scheduler } Normal Scheduled Successfully assigned redis-php to 192.168.1.247
2m 2m 1 {kubelet 192.168.1.247} spec.containers{frontend} Normal Pulled Container image "kubeguide/guestbook-php-frontend:localredis" already present on machine
2m 2m 1 {kubelet 192.168.1.247} spec.containers{frontend} Normal Created Created container with docker>
2m 2m 1 {kubelet 192.168.1.247} spec.containers{frontend} Normal Started Started container with docker> 2m 2m 1 {kubelet 192.168.1.247} spec.containers{redis-php} Normal Pulling pulling image "kubeguide/redis-master"
2m 2m 3 {kubelet 192.168.1.247} Warning MissingClusterDNS kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
2m 2m 1 {kubelet 192.168.1.247} spec.containers{redis-php} Normal Pulled Successfully pulled image "kubeguide/redis-master"
2m 2m 1 {kubelet 192.168.1.247} spec.containers{redis-php} Normal Created Created container with docker>
2m 2m 1 {kubelet 192.168.1.247} spec.containers{redis-php} Normal Started Started container with docker> 四、创建RC(Replication Controller)
vim myweb-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: myweb
spec:
replicas: 2
selector:
name: myweb
template:
metadata:
labels:
name: myweb
spec:
containers:
- name: myweb
image: kubeguide/tomcat-app:v1
ports:
- containerPort: 8080
创建pod kubectl create -f wyweb-rc.yaml
查看创建情况:kubectl get po
NAME READY STATUS RESTARTS AGE
command-demo 0/1 CrashLoopBackOff 38 2h
myweb-46x8r 1/1 Running 0 7m
redis-php 2/2 Running 0 2h