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?

More than 1 year has passed since last update.

Kubernetes完全ガイドのcentos周りのコマンドのメモ

Posted at

Kubernetes完全ガイド(初版)において、centosとdig周りのコマンドがうまくいかなかったのでメモです。(第二版では解決されているかもしれませんが、一応。)

kubectl run --image=centos:6 --restart=Never --rm -i testpod -- dig sample-externalip.default.svc.cluster.local CNAME

ただ(少なくとも自分の環境では) centos:6 がpullできないので、centos:7をpullしてくる必要があります。ただ、centos:7をpullすると今度はdigコマンドが入っていない問題にぶちあたります。

以下のコマンドで解決できます。

k run --image=centos:7 --restart=Never --rm -i testpod \
-- bash -c "yum -y install bind-utils && dig sample-externalip.default.svc.cluster.local"

結果は以下のようになります。

...(略)...

Complete!

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.9 <<>> sample-externalip.default.svc.cluster.local CNAME
;; global options: +cmd
;; Got answer:
;; WARNING: .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3795
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;sample-externalip.default.svc.cluster.local. IN	CNAME

;; AUTHORITY SECTION:
cluster.local.		30	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1656433610 7200 1800 86400 30

;; Query time: 1 msec
;; SERVER: 10.96.0.10#53(10.96.0.10)
;; WHEN: Tue Jun 28 16:37:18 UTC 2022
;; MSG SIZE  rcvd: 165
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?