이쿠의 슬기로운 개발생활

함께 성장하기 위한 보안 개발자 EverNote 내용 공유

Kubernetes/Kubernetes 이론

Sandbox key 정보로 Pod안의 Container 찾기(3) : 두번째 방법

이쿠우우 2020. 11. 7. 15:21
반응형

 

 

 

Sandbox key 정보로 Pod안의 Container 찾기 : 두번째 방법

 


Sandbox key 정보로 Pod안의 Container 찾기 관련 글 목록

Sandbox key 정보로 Pod안의 Container 찾기 : 환경구성

Sandbox key 정보로 Pod안의 Container 찾기 : 첫번째 방법

Sandbox key 정보로 Pod안의 Container 찾기 : 두번째 방법


 

config.v2.json 파일 정보만 가지고 Container ID를 찾아보기

 

 

 

 


목표

Sandbox Key, Pod의 IP, Container의 Port 

3가지 정보만 가지고 Container ID를 찾아보기

 

즉 어떤 Pod안에 있는 어떤 Container인지 확인해보기

 

 

이전 환경구성에서 확인한 Pod 정보를 가지고 시작함.

 

SandBox Key : c49cd99b3b89bee46441bddd59f491599c40d2f74b948fd7ee9775103bd5e7ee
IP : 10.244.1.212
Port : 8080

 


각 worker node로 접속해서 Sandbox Key에 해당하는 Container를 찾음

 

1. worker node 가 몇개인지 확인

명령어 : kubectl get nodes -o wide

확인 결과 : 1개의 master node 와 2개의 worker node IP확인가능

worker node one : 10.2.13.128

worker node two : 10.2.13.129

 

2. 확인한 worker node 로 접속

worker node one 으로 접속

경로 이동 : /var/lib/docker/containers

 

3. 조회되는 모든 directory 의 config.v2.json 파일 정보 확인

많은 디렉터리의 config.v2.json 내용 중 Sandbox Key 정보를 확인해서

사전에 받은 Sandbox Key 정보인

Sandbox Key : "/var/run/docker/netns/c49cd99b3b89" 와 일치되는 값을 확인

 

명령어 : cat config.v2.json | python -m json.tool

Pause Container 정보

{
    "AppArmorProfile": "",
    "Args": [],
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": null,
        "Domainname": "",
        "Entrypoint": [
            "/pause"
        ],
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "Hostname": "iksoon-deployment-66d46db549-qhxbs",
        "Image": "k8s.gcr.io/pause:3.2",
        "Labels": {
            "annotation.kubernetes.io/config.seen": "2020-08-05T08:40:26.901585777+09:00",
            "annotation.kubernetes.io/config.source": "api",
            "app": "iksoon-pod",
            "io.kubernetes.container.name": "POD",
            "io.kubernetes.docker.type": "podsandbox",
            "io.kubernetes.pod.name": "iksoon-deployment-66d46db549-qhxbs",
            "io.kubernetes.pod.namespace": "iksoon-ns",
            "io.kubernetes.pod.uid": "3e7400f5-0bd5-44a5-b6d9-52be0ab203f4",
            "pod-template-hash": "66d46db549"
        },
        "OnBuild": null,
        "OpenStdin": false,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": "/"
    },
    "Created": "2020-08-04T23:40:27.304439994Z",
    "Driver": "overlay2",
    "HasBeenManuallyStopped": false,
    "HasBeenStartedBefore": true,
    "HostnamePath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/hostname",
    "HostsPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/hosts",
    "ID": "ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807",
    "Image": "sha256:80d28bedfe5dec59da9ebf8e6260224ac9008ab5c11dbbe16ee3ba3e4439ac2c",
    "LogPath": "",
    "Managed": false,
    "MountLabel": "",
    "MountPoints": {},
    "Name": "/k8s_POD_iksoon-deployment-66d46db549-qhxbs_iksoon-ns_3e7400f5-0bd5-44a5-b6d9-52be0ab203f4_0",
    "NetworkSettings": {
        "Bridge": "",
        "HairpinMode": false,
        "HasSwarmEndpoint": false,
        "IsAnonymousEndpoint": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Networks": {
            "none": {
                "Aliases": null,
                "EndpointID": "fd4b4947a260c500ad0096c4877ccd93cdd8da0531d9bdca643340d88e3de4ea",
                "Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "IPAMConfig": null,
                "IPAMOperational": false,
                "IPAddress": "",
                "IPPrefixLen": 0,
                "IPv6Gateway": "",
                "Links": null,
                "MacAddress": "",
                "NetworkID": "03bd379a3deb0905fe8af97ec84516bcf520bae97c22dc0b9badbd6a9a3e968e"
            }
        },
        "Ports": {},
        "SandboxID": "c49cd99b3b89bee46441bddd59f491599c40d2f74b948fd7ee9775103bd5e7ee",
        "SandboxKey": "/var/run/docker/netns/c49cd99b3b89",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null,
        "Service": null
    },
    "NoNewPrivileges": false,
    "Path": "/pause",
    "ProcessLabel": "",
    "ResolvConfPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/resolv.conf",
    "RestartCount": 0,
    "SeccompProfile": "unconfined",
    "SecretReferences": null,
    "ShmPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/shm",
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Health": null,
        "OOMKilled": false,
        "Paused": false,
        "Pid": 17622,
        "RemovalInProgress": false,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2020-08-04T23:40:27.735064933Z"
    },
    "StreamConfig": {}
}

 

일치되는 값을 찾음 

해당 단계까지가 찾고자 하는 Container 가 있는 Pod 의 Pause Container 정보를 찾은 상태

 

[단계에서 확인한 정보]
workerNode : worker one
workerNode IP : 10.2.13.128



[지금까지 단계에서 확인한 정보]
workerNode : worker one
workerNode IP : 10.2.13.128

 

 

4. 해당 Pause 컨테이너의  Container ID 정보를 확인

 

해당 sandbox Key 에 해당하는 Pause Container의 ID를 확인함

 

Pause Container의 정보

명령어 : cat config.v2.json | python -m json.tool

{
    "AppArmorProfile": "",
    "Args": [],
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": null,
        "Domainname": "",
        "Entrypoint": [
            "/pause"
        ],
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        ],
        "Hostname": "iksoon-deployment-66d46db549-qhxbs",
        "Image": "k8s.gcr.io/pause:3.2",
        "Labels": {
            "annotation.kubernetes.io/config.seen": "2020-08-05T08:40:26.901585777+09:00",
            "annotation.kubernetes.io/config.source": "api",
            "app": "iksoon-pod",
            "io.kubernetes.container.name": "POD",
            "io.kubernetes.docker.type": "podsandbox",
            "io.kubernetes.pod.name": "iksoon-deployment-66d46db549-qhxbs",
            "io.kubernetes.pod.namespace": "iksoon-ns",
            "io.kubernetes.pod.uid": "3e7400f5-0bd5-44a5-b6d9-52be0ab203f4",
            "pod-template-hash": "66d46db549"
        },
        "OnBuild": null,
        "OpenStdin": false,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": "/"
    },
    "Created": "2020-08-04T23:40:27.304439994Z",
    "Driver": "overlay2",
    "HasBeenManuallyStopped": false,
    "HasBeenStartedBefore": true,
    "HostnamePath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/hostname",
    "HostsPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/hosts",
    "ID": "ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807", #이 정보가 해당 Pause Container의 Container ID
    "Image": "sha256:80d28bedfe5dec59da9ebf8e6260224ac9008ab5c11dbbe16ee3ba3e4439ac2c",
    "LogPath": "",
    "Managed": false,
    "MountLabel": "",
    "MountPoints": {},
    "Name": "/k8s_POD_iksoon-deployment-66d46db549-qhxbs_iksoon-ns_3e7400f5-0bd5-44a5-b6d9-52be0ab203f4_0",
    "NetworkSettings": {
        "Bridge": "",
        "HairpinMode": false,
        "HasSwarmEndpoint": false,
        "IsAnonymousEndpoint": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Networks": {
            "none": {
                "Aliases": null,
                "EndpointID": "fd4b4947a260c500ad0096c4877ccd93cdd8da0531d9bdca643340d88e3de4ea",
                "Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,
                "IPAMConfig": null,
                "IPAMOperational": false,
                "IPAddress": "",
                "IPPrefixLen": 0,
                "IPv6Gateway": "",
                "Links": null,
                "MacAddress": "",
                "NetworkID": "03bd379a3deb0905fe8af97ec84516bcf520bae97c22dc0b9badbd6a9a3e968e"
            }
        },
        "Ports": {},
        "SandboxID": "c49cd99b3b89bee46441bddd59f491599c40d2f74b948fd7ee9775103bd5e7ee",
        "SandboxKey": "/var/run/docker/netns/c49cd99b3b89",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null,
        "Service": null
    },
    "NoNewPrivileges": false,
    "Path": "/pause",
    "ProcessLabel": "",
    "ResolvConfPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/resolv.conf",
    "RestartCount": 0,
    "SeccompProfile": "unconfined",
    "SecretReferences": null,
    "ShmPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/shm",
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Health": null,
        "OOMKilled": false,
        "Paused": false,
        "Pid": 17622,
        "RemovalInProgress": false,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2020-08-04T23:40:27.735064933Z"
    },
    "StreamConfig": {}
}

 

결과 찾음 : ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807

 

5. Pause Container ID를 상속 받아있는 Container를 찾음

 

경로 이동 : /var/lib/docker/containers

이 경로에 있는 디렉터리의 config.v2.json 파일의 내용중

json 형식의

Config.Labels."io.kubernetes.sandbox.id" 

의 값이 Pause Container의 ID와 동일한 값을 가진 Container를 찾음

 

[만약 Pod안에 다수의 컨테이너가 있다면?]

Config.Labels."io.kubernetes.sandbox.id" 

값에 매칭 되는 container의 수가 

Pod안에 사용자가 생성한 Container 수와 동일함

Pod 안에 사용자가 생성한 Container를 파악했다면

그 중 Port번호에 매칭되는 1개의 Container를 찾으면 작업 완료

 

사용자가 생성한 Container의 정보 

{
    "AppArmorProfile": "",
    "Args": [
        "run"
    ],
    "Config": {
        "ArgsEscaped": true,
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "catalina.sh",
            "run"
        ],
        "Domainname": "",
        "Entrypoint": null,
        "Env": [
            "KUBERNETES_SERVICE_HOST=10.96.0.1",
            "KUBERNETES_SERVICE_PORT=443",
            "KUBERNETES_SERVICE_PORT_HTTPS=443",
            "KUBERNETES_PORT=tcp://10.96.0.1:443",
            "KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443",
            "KUBERNETES_PORT_443_TCP_PROTO=tcp",
            "KUBERNETES_PORT_443_TCP_PORT=443",
            "KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1",
            "PATH=/usr/local/tomcat/bin:/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LANG=C.UTF-8",
            "JAVA_HOME=/usr/local/openjdk-8",
            "JAVA_VERSION=8u242",
            "JAVA_BASE_URL=https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u242-b08/OpenJDK8U-jdk_",
            "JAVA_URL_VERSION=8u242b08",
            "CATALINA_HOME=/usr/local/tomcat",
            "TOMCAT_NATIVE_LIBDIR=/usr/local/tomcat/native-jni-lib",
            "LD_LIBRARY_PATH=/usr/local/tomcat/native-jni-lib",
            "GPG_KEYS=05AB33110949707C93A279E3D3EFE6B686867BA6 07E48665A34DCAFAE522E5E6266191C37C037D42 47309207D818FFD8DCD3F83F1931D684307A10A5 541FBE7D8F78B25E055DDEE13C370389288584E7 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 713DA88BE50911535FE716F5208B0AB1D63011C7 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED 9BA44C2621385CB966EBA586F72C284D731FABEE A27677289986DB50844682F8ACB77FC2E86E29AC A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23",
            "TOMCAT_MAJOR=8",
            "TOMCAT_VERSION=8.5.50",
            "TOMCAT_SHA512=ffca86027d298ba107c7d01c779318c05b61ba48767cc5967ee6ce5a88271bb6ec8eed60708d45453f30eeedddcaedd1a369d6df1b49eea2cd14fa40832cfb90"
        ],
        "ExposedPorts": {
            "8080/tcp": {}
        },
        "Healthcheck": {
            "Test": [
                "NONE"
            ]
        },
        "Hostname": "iksoon-deployment-66d46db549-qhxbs",
        "Image": "sha256:51821aad3f0f7c703342355052e8f796e0c99b509c491af98a100174981d72b5",
        "Labels": {
            "annotation.io.kubernetes.container.hash": "1defe9e0",
            "annotation.io.kubernetes.container.ports": "[{\"containerPort\":8080,\"protocol\":\"TCP\"}]",
            "annotation.io.kubernetes.container.restartCount": "0",
            "annotation.io.kubernetes.container.terminationMessagePath": "/dev/termination-log",
            "annotation.io.kubernetes.container.terminationMessagePolicy": "File",
            "annotation.io.kubernetes.pod.terminationGracePeriod": "30",
            "io.kubernetes.container.logpath": "/var/log/pods/iksoon-ns_iksoon-deployment-66d46db549-qhxbs_3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/iksoon-tomcat/0.log",
            "io.kubernetes.container.name": "iksoon-tomcat",
            "io.kubernetes.docker.type": "container",
            "io.kubernetes.pod.name": "iksoon-deployment-66d46db549-qhxbs",
            "io.kubernetes.pod.namespace": "iksoon-ns",
            "io.kubernetes.pod.uid": "3e7400f5-0bd5-44a5-b6d9-52be0ab203f4",
            "io.kubernetes.sandbox.id": "ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807" # pause container의 container ID와 동일한것을 확인
        },
        "OnBuild": null,
        "OpenStdin": false,
        "StdinOnce": false,
        "Tty": false,
        "User": "0",
        "Volumes": null,
        "WorkingDir": "/usr/local/tomcat"
    },
    "Created": "2020-08-04T23:40:27.875725311Z",
    "Driver": "overlay2",
    "HasBeenManuallyStopped": false,
    "HasBeenStartedBefore": true,
    "HostnamePath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/hostname",
    "HostsPath": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/etc-hosts",
    "ID": "328d5dd26738707109d6e89972b66158143255e99215d52df51cab33364d8a4e",
    "Image": "sha256:51821aad3f0f7c703342355052e8f796e0c99b509c491af98a100174981d72b5",
    "LogPath": "",
    "Managed": false,
    "MountLabel": "",
    "MountPoints": {
        "/dev/termination-log": {
            "Destination": "/dev/termination-log",
            "Driver": "",
            "Name": "",
            "Propagation": "rprivate",
            "RW": true,
            "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/containers/iksoon-tomcat/2ab67168",
            "Spec": {
                "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/containers/iksoon-tomcat/2ab67168",
                "Target": "/dev/termination-log",
                "Type": "bind"
            },
            "Type": "bind"
        },
        "/etc/hosts": {
            "Destination": "/etc/hosts",
            "Driver": "",
            "Name": "",
            "Propagation": "rprivate",
            "RW": true,
            "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/etc-hosts",
            "Spec": {
                "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/etc-hosts",
                "Target": "/etc/hosts",
                "Type": "bind"
            },
            "Type": "bind"
        },
        "/var/run/secrets/kubernetes.io/serviceaccount": {
            "Destination": "/var/run/secrets/kubernetes.io/serviceaccount",
            "Driver": "",
            "Name": "",
            "Propagation": "rprivate",
            "RW": false,
            "Relabel": "ro",
            "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/volumes/kubernetes.io~secret/default-token-ndzh5",
            "Spec": {
                "ReadOnly": true,
                "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/volumes/kubernetes.io~secret/default-token-ndzh5",
                "Target": "/var/run/secrets/kubernetes.io/serviceaccount",
                "Type": "bind"
            },
            "Type": "bind"
        }
    },
    "Name": "/k8s_iksoon-tomcat_iksoon-deployment-66d46db549-qhxbs_iksoon-ns_3e7400f5-0bd5-44a5-b6d9-52be0ab203f4_0",
    "NetworkSettings": {
        "Bridge": "",
        "HairpinMode": false,
        "HasSwarmEndpoint": false,
        "IsAnonymousEndpoint": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Networks": null,
        "Ports": null,
        "SandboxID": "",
        "SandboxKey": "",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null,
        "Service": null
    },
    "NoNewPrivileges": false,
    "Path": "catalina.sh",
    "ProcessLabel": "",
    "ResolvConfPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/resolv.conf",
    "RestartCount": 0,
    "SeccompProfile": "unconfined",
    "SecretReferences": null,
    "ShmPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/shm",
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Health": null,
        "OOMKilled": false,
        "Paused": false,
        "Pid": 17687,
        "RemovalInProgress": false,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2020-08-04T23:40:28.196694051Z"
    },
    "StreamConfig": {}
}

 

 

6. Container를 찾았다면 해당 Container의 Port가 찾고자 하는 Port와 동일한지 확인

 

Config.ExposedPorts 항목으로 Port를 확인함

우리가 찾는 8080 Port와 매칭되는지 확인.

{
    "AppArmorProfile": "",
    "Args": [
        "run"
    ],
    "Config": {
        "ArgsEscaped": true,
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "catalina.sh",
            "run"
        ],
        "Domainname": "",
        "Entrypoint": null,
        "Env": [
            "KUBERNETES_SERVICE_HOST=10.96.0.1",
            "KUBERNETES_SERVICE_PORT=443",
            "KUBERNETES_SERVICE_PORT_HTTPS=443",
            "KUBERNETES_PORT=tcp://10.96.0.1:443",
            "KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443",
            "KUBERNETES_PORT_443_TCP_PROTO=tcp",
            "KUBERNETES_PORT_443_TCP_PORT=443",
            "KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1",
            "PATH=/usr/local/tomcat/bin:/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "LANG=C.UTF-8",
            "JAVA_HOME=/usr/local/openjdk-8",
            "JAVA_VERSION=8u242",
            "JAVA_BASE_URL=https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u242-b08/OpenJDK8U-jdk_",
            "JAVA_URL_VERSION=8u242b08",
            "CATALINA_HOME=/usr/local/tomcat",
            "TOMCAT_NATIVE_LIBDIR=/usr/local/tomcat/native-jni-lib",
            "LD_LIBRARY_PATH=/usr/local/tomcat/native-jni-lib",
            "GPG_KEYS=05AB33110949707C93A279E3D3EFE6B686867BA6 07E48665A34DCAFAE522E5E6266191C37C037D42 47309207D818FFD8DCD3F83F1931D684307A10A5 541FBE7D8F78B25E055DDEE13C370389288584E7 61B832AC2F1C5A90F0F9B00A1C506407564C17A3 713DA88BE50911535FE716F5208B0AB1D63011C7 79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED 9BA44C2621385CB966EBA586F72C284D731FABEE A27677289986DB50844682F8ACB77FC2E86E29AC A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23",
            "TOMCAT_MAJOR=8",
            "TOMCAT_VERSION=8.5.50",
            "TOMCAT_SHA512=ffca86027d298ba107c7d01c779318c05b61ba48767cc5967ee6ce5a88271bb6ec8eed60708d45453f30eeedddcaedd1a369d6df1b49eea2cd14fa40832cfb90"
        ],
        "ExposedPorts": {
            "8080/tcp": {}
        }, # 포트번호가 8080 임으로 해당 Container가 우리가 찾던 Container임을 확인 할 수 있음
        "Healthcheck": {
            "Test": [
                "NONE"
            ]
        },
        "Hostname": "iksoon-deployment-66d46db549-qhxbs",
        "Image": "sha256:51821aad3f0f7c703342355052e8f796e0c99b509c491af98a100174981d72b5",
        "Labels": {
            "annotation.io.kubernetes.container.hash": "1defe9e0",
            "annotation.io.kubernetes.container.ports": "[{\"containerPort\":8080,\"protocol\":\"TCP\"}]",
            "annotation.io.kubernetes.container.restartCount": "0",
            "annotation.io.kubernetes.container.terminationMessagePath": "/dev/termination-log",
            "annotation.io.kubernetes.container.terminationMessagePolicy": "File",
            "annotation.io.kubernetes.pod.terminationGracePeriod": "30",
            "io.kubernetes.container.logpath": "/var/log/pods/iksoon-ns_iksoon-deployment-66d46db549-qhxbs_3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/iksoon-tomcat/0.log",
            "io.kubernetes.container.name": "iksoon-tomcat",
            "io.kubernetes.docker.type": "container",
            "io.kubernetes.pod.name": "iksoon-deployment-66d46db549-qhxbs",
            "io.kubernetes.pod.namespace": "iksoon-ns",
            "io.kubernetes.pod.uid": "3e7400f5-0bd5-44a5-b6d9-52be0ab203f4",
            "io.kubernetes.sandbox.id": "ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807" # pause container의 container ID와 동일한것을 확인
        },
        "OnBuild": null,
        "OpenStdin": false,
        "StdinOnce": false,
        "Tty": false,
        "User": "0",
        "Volumes": null,
        "WorkingDir": "/usr/local/tomcat"
    },
    "Created": "2020-08-04T23:40:27.875725311Z",
    "Driver": "overlay2",
    "HasBeenManuallyStopped": false,
    "HasBeenStartedBefore": true,
    "HostnamePath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/hostname",
    "HostsPath": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/etc-hosts",
    "ID": "328d5dd26738707109d6e89972b66158143255e99215d52df51cab33364d8a4e", #해당 부분이 우리가 찾고자 하는 Container의 ID
    "Image": "sha256:51821aad3f0f7c703342355052e8f796e0c99b509c491af98a100174981d72b5",
    "LogPath": "",
    "Managed": false,
    "MountLabel": "",
    "MountPoints": {
        "/dev/termination-log": {
            "Destination": "/dev/termination-log",
            "Driver": "",
            "Name": "",
            "Propagation": "rprivate",
            "RW": true,
            "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/containers/iksoon-tomcat/2ab67168",
            "Spec": {
                "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/containers/iksoon-tomcat/2ab67168",
                "Target": "/dev/termination-log",
                "Type": "bind"
            },
            "Type": "bind"
        },
        "/etc/hosts": {
            "Destination": "/etc/hosts",
            "Driver": "",
            "Name": "",
            "Propagation": "rprivate",
            "RW": true,
            "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/etc-hosts",
            "Spec": {
                "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/etc-hosts",
                "Target": "/etc/hosts",
                "Type": "bind"
            },
            "Type": "bind"
        },
        "/var/run/secrets/kubernetes.io/serviceaccount": {
            "Destination": "/var/run/secrets/kubernetes.io/serviceaccount",
            "Driver": "",
            "Name": "",
            "Propagation": "rprivate",
            "RW": false,
            "Relabel": "ro",
            "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/volumes/kubernetes.io~secret/default-token-ndzh5",
            "Spec": {
                "ReadOnly": true,
                "Source": "/var/lib/kubelet/pods/3e7400f5-0bd5-44a5-b6d9-52be0ab203f4/volumes/kubernetes.io~secret/default-token-ndzh5",
                "Target": "/var/run/secrets/kubernetes.io/serviceaccount",
                "Type": "bind"
            },
            "Type": "bind"
        }
    },
    "Name": "/k8s_iksoon-tomcat_iksoon-deployment-66d46db549-qhxbs_iksoon-ns_3e7400f5-0bd5-44a5-b6d9-52be0ab203f4_0",
    "NetworkSettings": {
        "Bridge": "",
        "HairpinMode": false,
        "HasSwarmEndpoint": false,
        "IsAnonymousEndpoint": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Networks": null,
        "Ports": null,
        "SandboxID": "",
        "SandboxKey": "",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null,
        "Service": null
    },
    "NoNewPrivileges": false,
    "Path": "catalina.sh",
    "ProcessLabel": "",
    "ResolvConfPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/resolv.conf",
    "RestartCount": 0,
    "SeccompProfile": "unconfined",
    "SecretReferences": null,
    "ShmPath": "/var/lib/docker/containers/ec1a38e949089e36269a87199c98ab64676ad1306eef4e14e0b4bebb664f9807/shm",
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Health": null,
        "OOMKilled": false,
        "Paused": false,
        "Pid": 17687,
        "RemovalInProgress": false,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2020-08-04T23:40:28.196694051Z"
    },
    "StreamConfig": {}
}

 

 

작업 완료.

우리가 찾고자 하는 Container의 ID : "328d5dd26738707109d6e89972b66158143255e99215d52df51cab33364d8a4e"

 

 

 


제 글을 복사할 시 출처를 명시해주세요.
글에 오타, 오류가 있다면 댓글로 알려주세요! 바로 수정하겠습니다!


 

 

반응형