YAML ↔ JSON
YAML の設定を JSON に、JSON を YAML に変換します。インデントを選べ、Kubernetes と GitHub Actions の例も用意しています。
ブラウザ内だけで動作します。入力した内容はどこにもアップロードされません。
マップ、シーケンス、フロースタイル、クォート文字列、ブロックスカラー、コメントに対応します。アンカー・エイリアス・タグは展開しません。
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "ryuslog-web",
"labels": {
"app": "ryuslog",
"tier": "frontend"
}
},
"spec": {
"replicas": 3,
"selector": {
"matchLabels": {
"app": "ryuslog"
}
},
"template": {
"metadata": {
"labels": {
"app": "ryuslog"
}
},
"spec": {
"containers": [
{
"name": "web",
"image": "ghcr.io/ryuslog/web:1.4.0",
"ports": [
{
"containerPort": 3000
}
],
"env": [
{
"name": "NODE_ENV",
"value": "production"
}
],
"resources": {
"limits": {
"cpu": "500m",
"memory": "512Mi"
}
},
"readinessProbe": {
"httpGet": {
"path": "/api/health",
"port": 3000
},
"initialDelaySeconds": 5,
"periodSeconds": 10
}
}
]
}
}
}
}YAML 構文リファレンス
クイックリファレンス- key: value
- マッピングの項目です。コロンの後には必ずスペースが必要で、インデントはタブではなくスペースを使います。
- - item
- そのインデント段のシーケンス項目です。項目の子キーは項目テキストの下にそろえます。
- |
- 改行をそのまま残すリテラルブロックスカラーです。複数行のシェルスクリプトや設定ファイルで使います。
- >
- 改行をスペースにまとめるフォールデッドブロックスカラーです。長い1段落を書くときに使います。
- [a, b] / {k: v}
- 短いシーケンスやマッピングを1行で書くフロースタイルの省略形です。
- # comment
- コメントは行末まで続き、JSON に変換すると失われます。
Kubernetes の関連文法ガイド
Kubernetes のガイドをすべて見るKubernetes Pending Pod: CPU Requests, Unbound PVC, Taints
The scheduler event names every node and its reason. Requests versus allocatable, untolerated taints, zonal volume binding, and impossible anti-affinity.
KubernetesKubernetes Exit Code 137 OOMKilled vs Exit Code 134 Heap Limits
137 is SIGKILL from the cgroup or a liveness probe; 134 is an abort, usually V8's own heap ceiling. Telling them apart and sizing the two limits together.
KubernetesCrashLoopBackOff: Reading Exit Codes and Debugging Restart Loops
The backoff is only the waiting state. The evidence is in Last State, the exit code, and the previous container's last log line, and each points to a different fix.
KubernetesImagePullBackOff and ErrImagePull: Reading the Real Pull Error
ImagePullBackOff hides five different failures. The event text names which one: wrong reference, missing credentials, wrong architecture, unreachable registry, or a rate limit.