1

これは私が得続けるものです:

al8-1@al8-1:~/kuber_test/pod_nginx$ kubectl get pods
NAME         READY   STATUS             RESTARTS   AGE
nginx        1/1     Running            0          6d2h
pod-apigw2   0/1     CrashLoopBackOff   1          15s

以下は、「kubectl describe pods pod-apigw2」からの出力です。

Name:         pod-apigw2
Namespace:    default
Priority:     0
Node:         al8-2/192.168.15.59
Start Time:   Wed, 26 Feb 2020 16:33:30 +0900
Labels:       <none>
Annotations:  cni.projectcalico.org/podIP: 192.168.4.55/32
Status:       Running
IP:           192.168.4.55
IPs:
  IP:  192.168.4.55
Containers:
  apigw2:
    Container ID:   docker://f684ef44ae53fd3176ddd7c051c9670da65da4bec84a1402359561abc646d85d
    Image:          parkdongwoo/apigw_test:v1
    Image ID:       docker-pullable://parkdongwoo/apigw_test@sha256:a447f131f0c9e63bb02a74708f4cbc2f6dd4551b0ba8f737b09072a8cc74c759
Port:           8080/TCP
Host Port:      0/TCP
State:          Waiting
  Reason:       CrashLoopBackOff
Last State:     Terminated
  Reason:       Completed
  Exit Code:    0
  Started:      Wed, 26 Feb 2020 16:37:00 +0900
  Finished:     Wed, 26 Feb 2020 16:37:00 +0900
Ready:          False
Restart Count:  5
Environment:    <none>
Mounts:
  /var/run/secrets/kubernetes.io/serviceaccount from default-token-z72r6 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-z72r6:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-z72r6
Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
             node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type     Reason     Age                    From               Message
  ----     ------     ----                   ----               -------
  Normal   Scheduled  <unknown>              default-scheduler  Successfully assigned default/pod-apigw2 to al8-2
  Normal   Pulled     4m26s (x4 over 5m23s)  kubelet, al8-2     Successfully pulled image "parkdongwoo/apigw_test:v1"
  Normal   Created    4m26s (x4 over 5m22s)  kubelet, al8-2     Created container apigw2
  Normal   Started    4m25s (x4 over 5m21s)  kubelet, al8-2     Started container apigw2
  Normal   Pulling    3m38s (x5 over 5m26s)  kubelet, al8-2     Pulling image "parkdongwoo/apigw_test:v1"
  Warning  BackOff    19s (x24 over 5m16s)   kubelet, al8-2     Back-off restarting failed container

しかし、ログを見ようとしたとき、何も出てこなかった

al8-1@al8-1:~/kuber_test/pod_nginx$ kubectl logs pod-apigw2
al8-1@al8-1:~/kuber_test/pod_nginx$ kubectl logs pod-apigw2 -p
al8-1@al8-1:~/kuber_test/pod_nginx$

これは私のyamlファイルです

apiVersion: v1
kind: Pod
metadata:
  name: pod-apigw2
spec:
  selector:
      app: apigw2
  containers:
      - name: apigw2
        image: parkdongwoo/apigw_test:v1
        imagePullPolicy: Always
        ports:
                - name: port-apigw2
                  containerPort: 8080

「docker run」でdockerイメージを実行すると、問題なくイメージを実行できましたが、kubernetesを介してのみクラッシュしました。

ログを表示せずにデバッグするにはどうすればよいですか?

4

3 に答える 3