Merge branch 'master' into patch-1
commit
ea55456454
|
@ -27,6 +27,7 @@ Kubernetes as a project supports and maintains [AWS](https://github.com/kubernet
|
||||||
* [Ambassador](https://www.getambassador.io/) API Gateway is an [Envoy](https://www.envoyproxy.io)-based ingress
|
* [Ambassador](https://www.getambassador.io/) API Gateway is an [Envoy](https://www.envoyproxy.io)-based ingress
|
||||||
controller.
|
controller.
|
||||||
* [Apache APISIX ingress controller](https://github.com/apache/apisix-ingress-controller) is an [Apache APISIX](https://github.com/apache/apisix)-based ingress controller.
|
* [Apache APISIX ingress controller](https://github.com/apache/apisix-ingress-controller) is an [Apache APISIX](https://github.com/apache/apisix)-based ingress controller.
|
||||||
|
* [Avi Kubernetes Operator](https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes) provides L4-L7 load-balancing using [VMware NSX Advanced Load Balancer](https://avinetworks.com/).
|
||||||
* The [Citrix ingress controller](https://github.com/citrix/citrix-k8s-ingress-controller#readme) works with
|
* The [Citrix ingress controller](https://github.com/citrix/citrix-k8s-ingress-controller#readme) works with
|
||||||
Citrix Application Delivery Controller.
|
Citrix Application Delivery Controller.
|
||||||
* [Contour](https://projectcontour.io/) is an [Envoy](https://www.envoyproxy.io/) based ingress controller.
|
* [Contour](https://projectcontour.io/) is an [Envoy](https://www.envoyproxy.io/) based ingress controller.
|
||||||
|
|
|
@ -311,7 +311,7 @@ If expanding underlying storage fails, the cluster administrator can manually re
|
||||||
PersistentVolume types are implemented as plugins. Kubernetes currently supports the following plugins:
|
PersistentVolume types are implemented as plugins. Kubernetes currently supports the following plugins:
|
||||||
|
|
||||||
* [`awsElasticBlockStore`](/docs/concepts/storage/volumes/#awselasticblockstore) - AWS Elastic Block Store (EBS)
|
* [`awsElasticBlockStore`](/docs/concepts/storage/volumes/#awselasticblockstore) - AWS Elastic Block Store (EBS)
|
||||||
* [`azureDisk`](/docs/concepts/sotrage/volumes/#azuredisk) - Azure Disk
|
* [`azureDisk`](/docs/concepts/storage/volumes/#azuredisk) - Azure Disk
|
||||||
* [`azureFile`](/docs/concepts/storage/volumes/#azurefile) - Azure File
|
* [`azureFile`](/docs/concepts/storage/volumes/#azurefile) - Azure File
|
||||||
* [`cephfs`](/docs/concepts/storage/volumes/#cephfs) - CephFS volume
|
* [`cephfs`](/docs/concepts/storage/volumes/#cephfs) - CephFS volume
|
||||||
* [`cinder`](/docs/concepts/storage/volumes/#cinder) - Cinder (OpenStack block storage)
|
* [`cinder`](/docs/concepts/storage/volumes/#cinder) - Cinder (OpenStack block storage)
|
||||||
|
|
|
@ -143,6 +143,44 @@ sudo mkdir -p /etc/containerd
|
||||||
sudo containerd config default | sudo tee /etc/containerd/config.toml
|
sudo containerd config default | sudo tee /etc/containerd/config.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Restart containerd
|
||||||
|
sudo systemctl restart containerd
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{% tab name="Debian 9+" %}}
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# (Install containerd)
|
||||||
|
## Set up the repository
|
||||||
|
### Install packages to allow apt to use a repository over HTTPS
|
||||||
|
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
## Add Docker's official GPG key
|
||||||
|
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
## Add Docker apt repository.
|
||||||
|
sudo add-apt-repository \
|
||||||
|
"deb [arch=amd64] https://download.docker.com/linux/debian \
|
||||||
|
$(lsb_release -cs) \
|
||||||
|
stable"
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
## Install containerd
|
||||||
|
sudo apt-get update && sudo apt-get install -y containerd.io
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Set default containerd configuration
|
||||||
|
sudo mkdir -p /etc/containerd
|
||||||
|
containerd config default | sudo tee /etc/containerd/config.toml
|
||||||
|
```
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Restart containerd
|
# Restart containerd
|
||||||
sudo systemctl restart containerd
|
sudo systemctl restart containerd
|
||||||
|
@ -523,4 +561,3 @@ sudo systemctl enable docker
|
||||||
|
|
||||||
Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/)
|
Refer to the [official Docker installation guides](https://docs.docker.com/engine/installation/)
|
||||||
for more information.
|
for more information.
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ content_type: concept
|
||||||
## CLIリファレンス
|
## CLIリファレンス
|
||||||
|
|
||||||
* [kubectl](/docs/reference/kubectl/overview/) - コマンドの実行やKubernetesクラスターの管理に使う主要なCLIツールです。
|
* [kubectl](/docs/reference/kubectl/overview/) - コマンドの実行やKubernetesクラスターの管理に使う主要なCLIツールです。
|
||||||
* [JSONPath](/docs/reference/kubectl/jsonpath/) - kubectlで[JSONPath記法](https://goessner.net/articles/JsonPath/)を使うための構文ガイドです。
|
* [JSONPath](/ja/docs/reference/kubectl/jsonpath/) - kubectlで[JSONPath記法](https://goessner.net/articles/JsonPath/)を使うための構文ガイドです。
|
||||||
* [kubeadm](/docs/reference/setup-tools/kubeadm/kubeadm/) - セキュアなKubernetesクラスターを簡単にプロビジョニングするためのCLIツールです。
|
* [kubeadm](/docs/reference/setup-tools/kubeadm/kubeadm/) - セキュアなKubernetesクラスターを簡単にプロビジョニングするためのCLIツールです。
|
||||||
|
|
||||||
## コンポーネントリファレンス
|
## コンポーネントリファレンス
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
---
|
||||||
|
title: JSONPathのサポート
|
||||||
|
content_type: concept
|
||||||
|
weight: 25
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- overview -->
|
||||||
|
kubectlはJSONPathのテンプレートをサポートしています。
|
||||||
|
|
||||||
|
<!-- body -->
|
||||||
|
|
||||||
|
JSONPathのテンプレートは、波括弧`{}`によって囲まれたJSONPathの式によって構成されています。
|
||||||
|
kubectlでは、JSONPathの式を使うことで、JSONオブジェクトの特定のフィールドをフィルターしたり、出力のフォーマットを変更することができます。
|
||||||
|
本来のJSONPathのテンプレートの構文に加え、以下の機能と構文が使えます:
|
||||||
|
|
||||||
|
1. JSONPathの式の内部でテキストをクォートするために、ダブルクォーテーションを使用します。
|
||||||
|
2. リストを反復するために、`range`、`end`オペレーターを使用します。
|
||||||
|
3. リストを末尾側から参照するために、負の数のインデックスを使用します。負の数のインデックスはリストを「周回」せず、`-index + listLength >= 0`が満たされる限りにおいて有効になります。
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
|
||||||
|
- 式は常にルートのオブジェクトから始まるので、`$`オペレーターの入力は任意になります。
|
||||||
|
|
||||||
|
- 結果のオブジェクトはString()関数を適用した形で表示されます。
|
||||||
|
|
||||||
|
{{< /note >}}
|
||||||
|
|
||||||
|
以下のようなJSONの入力が与えられたとします。
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"kind": "List",
|
||||||
|
"items":[
|
||||||
|
{
|
||||||
|
"kind":"None",
|
||||||
|
"metadata":{"name":"127.0.0.1"},
|
||||||
|
"status":{
|
||||||
|
"capacity":{"cpu":"4"},
|
||||||
|
"addresses":[{"type": "LegacyHostIP", "address":"127.0.0.1"}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind":"None",
|
||||||
|
"metadata":{"name":"127.0.0.2"},
|
||||||
|
"status":{
|
||||||
|
"capacity":{"cpu":"8"},
|
||||||
|
"addresses":[
|
||||||
|
{"type": "LegacyHostIP", "address":"127.0.0.2"},
|
||||||
|
{"type": "another", "address":"127.0.0.3"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"users":[
|
||||||
|
{
|
||||||
|
"name": "myself",
|
||||||
|
"user": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "e2e",
|
||||||
|
"user": {"username": "admin", "password": "secret"}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
機能 | 説明 | 例 | 結果
|
||||||
|
--------------------|---------------------------|-----------------------------------------------------------------|------------------
|
||||||
|
`text` | プレーンテキスト | `kind is {.kind}` | `kind is List`
|
||||||
|
`@` | 現在のオブジェクト | `{@}` | 入力した値と同じ値
|
||||||
|
`.` or `[]` | 子要素 | `{.kind}`, `{['kind']}` or `{['name\.type']}` | `List`
|
||||||
|
`..` | 子孫要素を再帰的に探す | `{..name}` | `127.0.0.1 127.0.0.2 myself e2e`
|
||||||
|
`*` | ワイルドカード。すべてのオブジェクトを取得する | `{.items[*].metadata.name}` | `[127.0.0.1 127.0.0.2]`
|
||||||
|
`[start:end:step]` | 添字 | `{.users[0].name}` | `myself`
|
||||||
|
`[,]` | 和集合 | `{.items[*]['metadata.name', 'status.capacity']}` | `127.0.0.1 127.0.0.2 map[cpu:4] map[cpu:8]`
|
||||||
|
`?()` | フィルター | `{.users[?(@.name=="e2e")].user.password}` | `secret`
|
||||||
|
`range`, `end` | リストの反復 | `{range .items[*]}[{.metadata.name}, {.status.capacity}] {end}` | `[127.0.0.1, map[cpu:4]] [127.0.0.2, map[cpu:8]]`
|
||||||
|
`''` | 解釈済みの文字列をクォートする | `{range .items[*]}{.metadata.name}{'\t'}{end}` | `127.0.0.1 127.0.0.2`
|
||||||
|
|
||||||
|
`kubectl`とJSONPathの式を使った例:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
kubectl get pods -o json
|
||||||
|
kubectl get pods -o=jsonpath='{@}'
|
||||||
|
kubectl get pods -o=jsonpath='{.items[0]}'
|
||||||
|
kubectl get pods -o=jsonpath='{.items[0].metadata.name}'
|
||||||
|
kubectl get pods -o=jsonpath="{.items[*]['metadata.name', 'status.capacity']}"
|
||||||
|
kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}'
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
Windowsでは、空白が含まれるJSONPathのテンプレートをクォートする場合は(上記のようにシングルクォーテーションを使うのではなく)、ダブルクォーテーションを使わなければなりません。
|
||||||
|
また、テンプレート内のリテラルをクォートする際には、シングルクォーテーションか、エスケープされたダブルクォーテーションを使わなければなりません。例えば:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{end}"
|
||||||
|
kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.startTime}{\"\n\"}{end}"
|
||||||
|
```
|
||||||
|
{{< /note >}}
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
|
||||||
|
JSONPathの正規表現はサポートされていません。正規表現を利用した検索を行いたい場合は、`jq`のようなツールを使ってください。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# kubectlはJSONpathの出力として正規表現をサポートしていないので、以下のコマンドは動作しない
|
||||||
|
kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}'
|
||||||
|
|
||||||
|
# 上のコマンドに期待される結果が欲しい場合、以下のコマンドを使うとよい
|
||||||
|
kubectl get pods -o json | jq -r '.items[] | select(.metadata.name | test("test-")).spec.containers[].image'
|
||||||
|
```
|
||||||
|
{{< /note >}}
|
|
@ -191,8 +191,8 @@ kubectl [command] [TYPE] [NAME] -o <output_format>
|
||||||
`-o custom-columns=<spec>` | [カスタムカラム](#custom-columns)のコンマ区切りのリストを使用して、テーブルを表示します。
|
`-o custom-columns=<spec>` | [カスタムカラム](#custom-columns)のコンマ区切りのリストを使用して、テーブルを表示します。
|
||||||
`-o custom-columns-file=<filename>` | `<filename>`ファイル内の[カスタムカラム](#custom-columns)のテンプレートを使用して、テーブルを表示します。
|
`-o custom-columns-file=<filename>` | `<filename>`ファイル内の[カスタムカラム](#custom-columns)のテンプレートを使用して、テーブルを表示します。
|
||||||
`-o json` | JSON形式のAPIオブジェクトを出力します。
|
`-o json` | JSON形式のAPIオブジェクトを出力します。
|
||||||
`-o jsonpath=<template>` | [jsonpath](/docs/reference/kubectl/jsonpath/)式で定義されたフィールドを表示します。
|
`-o jsonpath=<template>` | [jsonpath](/ja/docs/reference/kubectl/jsonpath/)式で定義されたフィールドを表示します。
|
||||||
`-o jsonpath-file=<filename>` | `<filename>`ファイル内の[jsonpath](/docs/reference/kubectl/jsonpath/)式で定義されたフィールドを表示します。
|
`-o jsonpath-file=<filename>` | `<filename>`ファイル内の[jsonpath](/ja/docs/reference/kubectl/jsonpath/)式で定義されたフィールドを表示します。
|
||||||
`-o name` | リソース名のみを表示します。
|
`-o name` | リソース名のみを表示します。
|
||||||
`-o wide` | 追加情報を含めて、プレーンテキスト形式で出力します。Podの場合は、Node名が含まれます。
|
`-o wide` | 追加情報を含めて、プレーンテキスト形式で出力します。Podの場合は、Node名が含まれます。
|
||||||
`-o yaml` | YAML形式のAPIオブジェクトを出力します。
|
`-o yaml` | YAML形式のAPIオブジェクトを出力します。
|
||||||
|
@ -263,7 +263,7 @@ pod-name 1m
|
||||||
|
|
||||||
### オブジェクトリストのソート
|
### オブジェクトリストのソート
|
||||||
|
|
||||||
ターミナルウィンドウで、オブジェクトをソートされたリストに出力するには、サポートされている`kubectl`コマンドに`--sort-by`フラグを追加します。`--sort-by`フラグで任意の数値フィールドや文字列フィールドを指定することで、オブジェクトをソートします。フィールドの指定には、[jsonpath](/docs/reference/kubectl/jsonpath/)式を使用します。
|
ターミナルウィンドウで、オブジェクトをソートされたリストに出力するには、サポートされている`kubectl`コマンドに`--sort-by`フラグを追加します。`--sort-by`フラグで任意の数値フィールドや文字列フィールドを指定することで、オブジェクトをソートします。フィールドの指定には、[jsonpath](/ja/docs/reference/kubectl/jsonpath/)式を使用します。
|
||||||
|
|
||||||
#### 構文
|
#### 構文
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue