admin 管理员组

文章数量: 887019

Kubernetes

Kubernetes | 《Kubernetes in Action中文版》第8章错误

1. 查看容器详情

Name:         downward
Namespace:    default
Priority:     0
Node:         minikube/192.168.64.3
Start Time:   Mon, 29 Nov 2021 09:43:23 +0800
Labels:       <none>
Annotations:  <none>
Status:       Pending
IP:
IPs:          <none>
Containers:main:Container ID:Image:         k8s.gcr.io/busyboxImage ID:Port:          <none>Host Port:     <none>Command:sleep9999999State:          WaitingReason:       ContainerCreatingReady:          FalseRestart Count:  0Limits:cpu:     500mmemory:  4MiRequests:cpu:     250mmemory:  100KiEnvironment:POD_NAME:         downward (v1:metadata.name)POD_NAMESPACE:    default (v1:metadata.namespace)POD_IP:            (v1:status.podIP)NODE_NAME:         (v1:spec.nodeName)SERVICE_ACCOUNT:   (v1:spec.serviceAccountName)Mounts:/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-4js5b (ro)
Conditions:Type              StatusInitialized       TrueReady             FalseContainersReady   FalsePodScheduled      True
Volumes:kube-api-access-4js5b:Type:                    Projected (a volume that contains injected data from multiple sources)TokenExpirationSeconds:  3607ConfigMapName:           kube-root-ca.crtConfigMapOptional:       <nil>DownwardAPI:             true
QoS Class:                   Burstable
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300snode.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:Type     Reason                  Age              From               Message----     ------                  ----             ----               -------Normal   Scheduled               3s               default-scheduler  Successfully assigned default/downward to minikubeWarning  FailedCreatePodSandBox  3s               kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to start sandbox container for pod "downward": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:348: copying bootstrap data to pipe caused: write init-p: broken pipe: unknownNormal   SandboxChanged          1s (x2 over 2s)  kubelet            Pod sandbox changed, it will be killed and re-created.Warning  FailedCreatePodSandBox  1s (x2 over 2s)  kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to start sandbox container for pod "downward": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:352: getting the final child's pid from pipe caused: read init-p: connection reset by peer: unknown

2. 原因

给容器分配的内存过低无法启动。

3. 解决办法

  • downward-api-env.yaml
  • downward-api-volume.yaml

修改上面两个文件中下面标注的两处位置。

# ...
spec:containers:- name: mainimage: busyboxcommand: ["sleep", "9999999"]resources:requests:cpu: 15m# 修改此处memory: 64Milimits:cpu: 100m# 修改此处memory: 128Mi
# ...    

本文标签: kubernetes