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.

CKA試験、Kube-dns

Last updated at Posted at 2023-04-26

Serviceと、DNS Lookup

問題

  • nginx imageを使用するresolver podを作成し、resolver-serviceというサービスを構成します
  • クラスタ内で、ServiceとPodのあんまえを参照できるのかテストします
  • dns 参照に使うPodのImageはbusyboxで、ServiceとPodの名前の参照はnslookupです
  • Service参照結果は/var/CKA2023/nginx.svcに、Pod名を参照した結果は/var/CKA2023/nginx.pod記録します
kubectl run resolver --image=nginx
kubectl expose pod resolver --port=80 --name=resolver-service

kubectl get pods
# PodのIPを記録
# 123.123.123.123

kubectl get service
# ServiceのClusterIPを記録
# 111.111.111.111

kubectl run test --image=busybox -it --rm /bin/bash
#testPod内部

# pod のdnsを確認
nslookup 123-123-123-123.default.pod.cluster.local

# service のdnsを確認
nslookup 111.111.111.111

結果をファイルを保存

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?