問題
ps -ef
を実行すると、一般的にはコマンドの詳細を表示してくれるが、特にコンテナ環境をホストする軽量OSでは途中でコマンド詳細が途切れて表示されてしまうことがある。
$ oc exec -it ingress-operator-79bb474fcc-lm8k9 -n openshift-ingress-operator -- ps -ef
Defaulted container "ingress-operator" out of: ingress-operator, kube-rbac-proxy
UID PID PPID C STIME TTY TIME CMD
1000130+ 1 0 0 May25 ? 00:24:19 ingress-operator start --namespace openshift-ingress-operator --image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:5460207dedbfc16cc26527f5fc7ccc8143242b1
1000130+ 284 0 0 07:51 pts/0 00:00:00 ps -ef
$ oc exec -it ingress-operator-79bb474fcc-lm8k9 -n openshift-ingress-operator -- bash
Defaulted container "ingress-operator" out of: ingress-operator, kube-rbac-proxy
bash-4.4$ ps -ef
UID PID PPID C STIME TTY TIME CMD
1000130+ 1 0 0 May25 ? 00:24:19 ingress-operator start --namespace openshift-ingress-operator --image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:5460207dedbfc16cc26527f5fc7ccc8143242b1
1000130+ 367 0 1 07:56 pts/0 00:00:00 bash
1000130+ 373 367 0 07:56 pts/0 00:00:00 ps -ef
代替策1('--cols'オプションを付ける)
$ oc exec -it ingress-operator-79bb474fcc-lm8k9 -n openshift-ingress-operator -- ps -ef --cols=999
Defaulted container "ingress-operator" out of: ingress-operator, kube-rbac-proxy
UID PID PPID C STIME TTY TIME CMD
1000130+ 1 0 0 May25 ? 00:24:19 ingress-operator start --namespace openshift-ingress-operator --image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:5460207dedbfc16cc26527f5fc7ccc8143242b1d4ca329476441cce3672a992b --canary-image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:9ff44618f8fab99e6ad3daa1b83481a74473507effbb2f80b41c6ac474ad0995 --release-version 4.13.0
1000130+ 290 0 0 07:51 pts/0 00:00:00 ps -ef --cols=999
$ oc exec -it ingress-operator-79bb474fcc-lm8k9 -n openshift-ingress-operator -- bash
Defaulted container "ingress-operator" out of: ingress-operator, kube-rbac-proxy
bash-4.4$ ps -ef --cols=999
UID PID PPID C STIME TTY TIME CMD
1000130+ 1 0 0 May25 ? 00:24:19 ingress-operator start --namespace openshift-ingress-operator --image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:5460207dedbfc16cc26527f5fc7ccc8143242b1d4ca329476441cce3672a992b --canary-image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:9ff44618f8fab99e6ad3daa1b83481a74473507effbb2f80b41c6ac474ad0995 --release-version 4.13.0
1000130+ 367 0 0 07:56 pts/0 00:00:00 bash
1000130+ 374 367 0 07:56 pts/0 00:00:00 ps -ef --cols=999
代替策2(COLUMNS環境変数を利用)
$ oc exec -it ingress-operator-79bb474fcc-lm8k9 -n openshift-ingress-operator -- bash
Defaulted container "ingress-operator" out of: ingress-operator, kube-rbac-proxy
bash-4.4$ COLUMNS=999 ps -ef
UID PID PPID C STIME TTY TIME CMD
1000130+ 1 0 0 May25 ? 00:24:20 ingress-operator start --namespace openshift-ingress-operator --image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:5460207dedbfc16cc26527f5fc7ccc8143242b1d4ca329476441cce3672a992b --canary-image quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:9ff44618f8fab99e6ad3daa1b83481a74473507effbb2f80b41c6ac474ad0995 --release-version 4.13.0
1000130+ 367 0 0 07:56 pts/0 00:00:00 bash
1000130+ 375 367 0 07:57 pts/0 00:00:00 ps -ef