1. kubectl get pods
    2. NAME READY STATUS RESTARTS AGE
    3. httpbin-service-86444cd555-82nn6 1/1 Running 0 6m24s

    查看日志

    1. kubectl logs httpbin-service-86444cd555-82nn6
    2. [2020-07-11 16:15:52 +0000] [1] [INFO] Starting gunicorn 19.9.0
    3. [2020-07-11 16:15:52 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1)
    4. [2020-07-11 16:15:52 +0000] [1] [INFO] Using worker: gevent
    5. [2020-07-11 16:15:52 +0000] [8] [INFO] Booting worker with pid: 8

    默认日志存储路径

    1. ls /var/log/containers/ |grep hello-world
    2. hello-world-client-57ff5b74c6-4b7dd_baxiang_hello-world-client-b5115e3200b44e4e87402755ecc3fda987a9f077eb5cdda6911937e5c9d1e61f.log
    3. hello-world-server-65f8648b8c-s22g2_baxiang_hello-world-server-1b2b16d41b9bd83ccfa7df42608acc47d98121c9864aeededc9c83b814a631bd.log

    Pod 在 Node 节点上的日志存储位置为 /var/log/containers ,查看日志内容

    1. # tail hello-world-client-57ff5b74c6-4b7dd_baxiang_hello-world-client-b5115e3200b44e4e87402755ecc3fda987a9f077eb5cdda6911937e5c9d1e61f.log
    2. {"log":" - using code:\u0009gin.SetMode(gin.ReleaseMode)\n","stream":"stdout","time":"2020-07-07T02:03:32.394140946Z"}
    3. {"log":"\n","stream":"stdout","time":"2020-07-07T02:03:32.394143047Z"}
    4. {"log":"[GIN-debug] GET / --\u003e main.indexHandler (3 handlers)\n","stream":"stdout","time":"2020-07-07T02:03:32.394145044Z"}
    5. {"log":"[GIN-debug] GET /ip --\u003e main.ipHandler (3 handlers)\n","stream":"stdout","time":"2020-07-07T02:03:32.394147314Z"}
    6. {"log":"[GIN-debug] GET /ping --\u003e main.pingHandler (3 handlers)\n","stream":"stdout","time":"2020-07-07T02:03:32.394149611Z"}
    7. {"log":"[GIN-debug] Listening and serving HTTP on :8081\n","stream":"stdout","time":"2020-07-07T02:03:32.394162027Z"}
    8. {"log":"[GIN] 2020/07/07 - 02:03:37 | 200 | 1.271637ms | 192.168.0.3 | GET \"/\"\n","stream":"stdout","time":"2020-07-07T02:03:37.627262063Z"}
    9. {"log":"[GIN] 2020/07/07 - 02:03:39 | 404 | 561ns | 192.168.0.3 | GET \"/favicon.ico\"\n","stream":"stdout","time":"2020-07-07T02:03:39.798283008Z"}
    10. {"log":"[GIN] 2020/07/07 - 02:03:46 | 200 | 1.210817ms | 192.168.0.3 | GET \"/ping\"\n","stream":"stdout","time":"2020-07-07T02:03:46.781980535Z"}
    11. {"log":"[GIN] 2020/07/08 - 02:17:44 | 200 | 5.132089952s | 192.168.0.3 | GET \"/\"\n","stream":"stdout","time":"2020-07-08T02:17:44.58210837Z"}