0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows で Docker Desktop その4

0
Last updated at Posted at 2025-06-15

Windows で Docker Desktop その3の続きです。

Pod 内で ps コマンドを実行してみます。

PS C:\Users\xxx\TKB\pods> kubectl exec hello-pod -- ps
PID   USER     TIME  COMMAND
    1 root      0:00 {MainThread} node ./app.js
   17 root      0:00 ps

Pod 内で curl コマンドを実行してみます。

PS C:\Users\xxx\TKB\pods> kubectl exec hello-pod -- curl localhost:8080
error: Internal error occurred: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "e440f1c581cc30c53d75a166f978d6d0fb1894477fa4009df450b5b3899ed8af": OCI runtime exec failed: exec failed: unable to start container process: exec: "curl": executable file not found in $PATH: unknown

sh コマンドならどうでしょうか。

PS C:\Users\xxx\TKB\pods> kubectl exec -it hello-pod -- sh
/src #

この Pod の Alpine Linux に curl パッケージを追加して、また実行してみます。

/src # cat /etc/*release*
3.21.3
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.21.3
PRETTY_NAME="Alpine Linux v3.21"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

/src # apk add curl
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
(1/9) Installing brotli-libs (1.1.0-r2)
(2/9) Installing c-ares (1.34.5-r0)
(3/9) Installing libunistring (1.2-r0)
(4/9) Installing libidn2 (2.3.7-r0)
(5/9) Installing nghttp2-libs (1.64.0-r0)
(6/9) Installing libpsl (0.21.5-r3)
(7/9) Installing zstd-libs (1.5.6-r2)
(8/9) Installing libcurl (8.12.1-r1)
(9/9) Installing curl (8.12.1-r1)
Executing busybox-1.37.0-r12.trigger
OK: 14 MiB in 26 packages

/src # curl localhost:8080
<html><head><title>K8s rocks</title><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"/></head><body><div class="container"><div class="jumbotron"><h1 style="text-align:center;">Kubernetes rocks!</h1><p style="text-align:center;">Check out my AI book.</p><p style="text-align:center;">          <a class="btn btn-primary" href="https://www.amazon.com/dp/1916585388">AI Explained: Facts, Fiction, and Future</a></p></div></div></body></html>/src #

今度は実行できました。

env コマンドを実行してみます。

/src # env
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT=tcp://10.96.0.1:443
NODE_VERSION=23.8.0
HOSTNAME=hello-pod
YARN_VERSION=1.22.22
SHLVL=1
HOME=/root
TERM=xterm
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_HOST=10.96.0.1
/src # exit
PS C:\Users\xxx\TKB\pods>

Windows で Docker Desktop その5に続く。

参考文献

Poulton, N. (2025). The kubernetes book (2025 ed.). Nigel Poulton.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?