LoginSignup
4
2

More than 3 years have passed since last update.

Kubernetesのマニフェストファイルのフォーマットを調べる

Posted at

Kubernetesの情報を本なりWebなりで見ていると、マニフェストファイルの例はたくさん出てきます。でもやっているうちに結局どんなパラメーターがあるの?と思ってフォーマットについて調べてみたけど、ちょっと辿り着きづらかったのでメモ。

Web上で確認する

マニフェストファイルではなく、APIのドキュメントとしてまとまっていました。
たとえば現時点で最新のv1.14はこちら。
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/

kubectlで確認する

kubectl explainを使うと、現在のコンテキストのバージョンに沿った情報を出してくれます。

全体の階層を確認する

kubectl explain <リソース> --recursiveで全体の階層を表示。
Webだとこんな形で見れないのでとても便利!

$ kubectl explain service --recursive
KIND:     Service
VERSION:  v1

DESCRIPTION:
     Service is a named abstraction of software service (for example, mysql)
     consisting of local port (for example 3306) that the proxy listens on, and
     the selector that determines which pods will answer requests sent through
     the proxy.

FIELDS:
   apiVersion   <string>
   kind <string>
   metadata     <Object>
      annotations       <map[string]string>
(略)

特定のパラメーターについての説明を表示

kubectl explain <リソース>.<階層>(.<階層>…)でパラメーターの説明を表示。

$ kubectl explain service.spec.type
KIND:     Service
VERSION:  v1

FIELD:    type <string>

DESCRIPTION:
     type determines how the Service is exposed. Defaults to ClusterIP. Valid
     options are ExternalName, ClusterIP, NodePort, and LoadBalancer.
(略)
4
2
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
4
2