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 3 years have passed since last update.

flannelで使用していたNetworkって何だっけ?

Posted at

と思ったときに叩くコマンドです。

その1: Podでコマンドを実行して確認する

flannelで使用するセグメントは、Podにある/etc/kube-flannel/net-conf.jsonに記載されています。

kubectl exec -it -n kube-system $(kubectl get pods -n kube-system | grep kube-flannel | cut -f 1 -d ' ') -- cat /etc/kube-flannel/net-conf.json

出力

Defaulted container "kube-flannel" out of: kube-flannel, install-cni (init)
{
  "Network": "10.244.0.0/16",
  "Backend": {
    "Type": "vxlan"
  }
}

その2: ConfigMapを確認

root@k8s-master1:~# kubectl get cm -n kube-system kube-flannel-cfg -o json | jq '.data["net-conf.json"]'

出力(defaultで改行コード入ります)

"{\n  \"Network\": \"10.244.0.0/16\",\n  \"Backend\": {\n    \"Type\": \"vxlan\"\n  }\n}\n"

その他

root@k8s-master1:~# kubectl get cm -n kube-system kube-flannel-cfg -o jsonpath --template {'.data["net-conf.json"]'}
error: error parsing jsonpath {.data["net-conf.json"]}, invalid array index "net-conf.json"

jqコマンドと同じようにはいきませんでした。

[ jq ] keyの値にドット(.)が入っているときはどうするか - Qiita

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?