From 333a1e658e6655d70bd38a546e1b35dbfae3b5d2 Mon Sep 17 00:00:00 2001 From: wwgfhf <51694849+wwgfhf@users.noreply.github.com> Date: Wed, 1 Apr 2020 09:09:11 +0800 Subject: [PATCH 01/67] Update nl.toml --- i18n/nl.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i18n/nl.toml b/i18n/nl.toml index bb334b1a65..a0aa6faee4 100644 --- a/i18n/nl.toml +++ b/i18n/nl.toml @@ -189,6 +189,8 @@ other = "Stack Overflow" other = "Forum" [community_events_calendar] other = "Evenementenkalender" +[community_youtube_name] +other = "YouTube" # UI elements [ui_search_placeholder] From 741362495a05e1fb7cdfc25ec49085df77e7c3aa Mon Sep 17 00:00:00 2001 From: Arhell Date: Wed, 8 Apr 2020 18:32:21 +0300 Subject: [PATCH 02/67] fixed footer text that goes beyond the screen --- assets/sass/_base.sass | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/sass/_base.sass b/assets/sass/_base.sass index c59d20c346..e32e285ad0 100644 --- a/assets/sass/_base.sass +++ b/assets/sass/_base.sass @@ -439,6 +439,7 @@ footer width: 100% background-image: url(/images/texture.png) background-color: $dark-grey + overflow-x: hidden .main-section padding: 20px 0 From 26aa0d7e9b75d27b8982a7954659d8bce75b4e00 Mon Sep 17 00:00:00 2001 From: Radoslaw Smigielski Date: Wed, 8 Apr 2020 22:15:28 +0100 Subject: [PATCH 03/67] Make build of kubernetes-hugo image more reliable Switch from default Docker bridge network to host network. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 56359bd32b..75d37f767d 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,10 @@ serve: ## Boot the development server. hugo server --buildFuture docker-image: - $(DOCKER) build . --tag $(DOCKER_IMAGE) --build-arg HUGO_VERSION=$(HUGO_VERSION) + $(DOCKER) build . \ + --network=host \ + --tag $(DOCKER_IMAGE) \ + --build-arg HUGO_VERSION=$(HUGO_VERSION) docker-build: $(DOCKER_RUN) $(DOCKER_IMAGE) hugo From 4c39f03a88c2c1b60174ca11b1ff85e75bfe7f6f Mon Sep 17 00:00:00 2001 From: Jared Date: Tue, 14 Apr 2020 13:52:06 -0700 Subject: [PATCH 04/67] Removing myself from the owner aliases file :( I will be stepping back from working on Kubernetes to focus on other projects. So long and thanks for all the fish! --- OWNERS_ALIASES | 2 -- 1 file changed, 2 deletions(-) diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES index e02287ac56..6f3337df36 100644 --- a/OWNERS_ALIASES +++ b/OWNERS_ALIASES @@ -41,7 +41,6 @@ aliases: sig-docs-en-owners: # Admins for English content - bradtopol - daminisatya - - jaredbhatti - jimangel - kbarnard10 - kbhawkey @@ -58,7 +57,6 @@ aliases: sig-docs-en-reviews: # PR reviews for English content - bradtopol - daminisatya - - jaredbhatti - jimangel - kbarnard10 - kbhawkey From 1be5c1114b78f7e9f68100b1aa8fe8d14e0f5d06 Mon Sep 17 00:00:00 2001 From: Arhell Date: Wed, 15 Apr 2020 03:00:49 +0300 Subject: [PATCH 05/67] fix broken field on the main page in the video block --- assets/sass/_base.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/sass/_base.sass b/assets/sass/_base.sass index c59d20c346..07e489055d 100644 --- a/assets/sass/_base.sass +++ b/assets/sass/_base.sass @@ -1214,7 +1214,7 @@ $feature-box-div-margin-bottom: 40px margin-bottom: 20px #desktopKCButton - position: relative + position: absolute font-size: 18px background-color: $dark-grey border-radius: 8px From f233023a08ef8dfa5b0d4d0885b239f2af3f385a Mon Sep 17 00:00:00 2001 From: Yudi A Phanama Date: Sun, 19 Apr 2020 12:10:31 +0700 Subject: [PATCH 06/67] Update Install Kubectl ID page - Change several "instalasi" nouns to "menginstal" verbs - Add some native Indonesian words with hints. E.g alat baris perintah, skrip penyelesaian, penyelesaian otomatis. - Fix some grammar, punctuations, and add clarity. E.g "di" to "pada" preposition, commas, etc. manajer paket, etc. - Fix broken list item numberings. - Fix some non-standard words. E.g kluster to klaster, binari to program. Signed-off-by: Yudi A Phanama --- .../id/docs/tasks/tools/install-kubectl.md | 202 +++++++++--------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/content/id/docs/tasks/tools/install-kubectl.md b/content/id/docs/tasks/tools/install-kubectl.md index 3f24efef54..fc9b672c5e 100644 --- a/content/id/docs/tasks/tools/install-kubectl.md +++ b/content/id/docs/tasks/tools/install-kubectl.md @@ -1,28 +1,28 @@ --- -title: Instalasi dan Konfigurasi kubectl +title: Menginstal dan Menyiapkan kubectl content_template: templates/task weight: 10 card: name: tasks weight: 20 - title: Instalasi kubectl + title: Menginstal kubectl --- {{% capture overview %}} -[Kubectl](/docs/user-guide/kubectl/) adalah perangkat barisan perintah Kubernetes yang digunakan untuk menjalankan berbagai perintah untuk kluster Kubernetes. Kamu dapat menggunakan `kubectl` untuk men-_deploy_ aplikasi, mengatur _resource_ kluster, dan melihat _log_. Daftar operasi `kubectl` dapat dilihat di [Ikhtisar kubectl](/docs/reference/kubectl/overview/). +[Kubectl](/docs/user-guide/kubectl/) adalah alat baris perintah (_command line tool_) Kubernetes yang digunakan untuk menjalankan berbagai perintah untuk klaster Kubernetes. Kamu dapat menggunakan `kubectl` untuk men-_deploy_ aplikasi, mengatur sumber daya klaster, dan melihat log. Daftar operasi `kubectl` dapat dilihat di [Ikhtisar kubectl](/docs/reference/kubectl/overview/). {{% /capture %}} {{% capture prerequisites %}} -Kamu boleh menggunakan `kubectl` versi berapapun selama versi minornya sama atau berbeda satu. Misal, klien v1.2 masih dapat digunakan dengan v1.1, v1.2, dan 1.3 master. Menggunakan versi terbaru `kubectl` dapat menghindari permasalahan yang tidak terduga. +Kamu harus menggunakan kubectl dengan perbedaan maksimal satu versi minor dengan klaster kamu. Misalnya, klien v1.2 masih dapat digunakan dengan master v1.1, v1.2, dan 1.3. Menggunakan versi terbaru `kubectl` dapat menghindari permasalahan yang tidak terduga. {{% /capture %}} {{% capture steps %}} -## Instalasi kubectl di Linux +## Menginstal kubectl pada Linux -### Instalasi binari kubectl dengan curl di Linux +### Menginstal program kubectl menggunakan curl pada Linux -1. Unduh versi terbaru dengan perintah: +1. Unduh versi terbarunya dengan perintah: ``` curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl @@ -30,30 +30,30 @@ Kamu boleh menggunakan `kubectl` versi berapapun selama versi minornya sama atau Untuk mengunduh versi spesifik, ganti bagian `curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt` dengan versi yang diinginkan. - Misal, untuk mengunduh versi {{< param "fullversion" >}} di Linux, ketik: + Misalnya, untuk mengunduh versi {{< param "fullversion" >}} di Linux, ketik: ``` curl -LO https://storage.googleapis.com/kubernetes-release/release/{{< param "fullversion" >}}/bin/linux/amd64/kubectl ``` -1. Buat agar binari `kubectl` dapat dijalankan. +2. Jadikan program `kubectl` dapat dieksekusi. ``` chmod +x ./kubectl ``` -1. Pindahkan ke PATH komputer. +3. Pindahkan ke PATH kamu. ``` sudo mv ./kubectl /usr/local/bin/kubectl ``` -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +4. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client ``` -### Instalasi dengan paket manajer bawaan +### Menginstal dengan manajer paket (_package manager_) bawaan {{< tabs name="kubectl_install" >}} {{< tab name="Ubuntu, Debian or HypriotOS" codelang="bash" >}} @@ -76,11 +76,11 @@ yum install -y kubectl {{< /tab >}} {{< /tabs >}} -### Instalasi dengan paket manajer lain +### Menginstal dengan manajer paket lain {{< tabs name="other_kubectl_install" >}} {{% tab name="Snap" %}} -Jika kamu menggunakan Ubuntu atau versi Linux lain yang mendukung paket manajer [snap](https://snapcraft.io/docs/core/install), `kubectl` tersedia dalam bentuk aplikasi di [snap](https://snapcraft.io/). +Jika kamu menggunakan Ubuntu atau versi Linux lain yang mendukung manajer paket [snap](https://snapcraft.io/docs/core/install), `kubectl` tersedia dalam bentuk aplikasi di [snap](https://snapcraft.io/). ```shell snap install kubectl --classic @@ -89,7 +89,7 @@ kubectl version --client ``` {{% /tab %}} {{% tab name="Homebrew" %}} -Jika kamu menggunakan Linux dengan paket manajer [Homebrew](https://docs.brew.sh/Homebrew-on-Linux), `kubectl` sudah tersedia untuk diinstal di [Homebrew](https://docs.brew.sh/Homebrew-on-Linux#install). +Jika kamu menggunakan Linux dengan manajer paket [Homebrew](https://docs.brew.sh/Homebrew-on-Linux), `kubectl` sudah tersedia untuk diinstal di [Homebrew](https://docs.brew.sh/Homebrew-on-Linux#install). ```shell brew install kubectl @@ -98,11 +98,11 @@ kubectl version --client {{% /tab %}} {{< /tabs >}} -## Instalasi kubectl di macOS +## Menginstal kubectl pada macOS -### Instalasi binari kubectl dengan curl di macOS +### Menginstal program kubectl dengan curl pada macOS -1. Unduh versi terbaru dengan perintah: +1. Unduh versi terbarunya dengan perintah: ``` curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl" @@ -110,32 +110,32 @@ kubectl version --client Untuk mengunduh versi spesifik, ganti bagian `curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt` dengan versi yang diinginkan. - Misal, untuk mengunduh versi {{< param "fullversion" >}} di macOS, ketik: + Misalnya, untuk mengunduh versi {{< param "fullversion" >}} pada macOS, ketik: ``` curl -LO https://storage.googleapis.com/kubernetes-release/release/{{< param "fullversion" >}}/bin/darwin/amd64/kubectl ``` -1. Buat agar binari `kubectl` dapat dijalankan. +2. Buat agar program `kubectl` dapat dijalankan. ``` chmod +x ./kubectl ``` -1. Pindahkan ke PATH komputer. +3. Pindahkan ke PATH kamu. ``` sudo mv ./kubectl /usr/local/bin/kubectl ``` -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +4. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client ``` -### Instalasi dengan Homebrew di macOS +### Menginstal dengan Homebrew pada macOS -Jika kamu menggunakan macOS dan paket manajer [Homebrew](https://brew.sh/), kamu dapat menginstal `kubectl` langsung dengan Homebrew. +Jika kamu menggunakan macOS dan manajer paket [Homebrew](https://brew.sh/), kamu dapat menginstal `kubectl` langsung dengan Homebrew. 1. Jalankan perintah: @@ -148,15 +148,15 @@ Jika kamu menggunakan macOS dan paket manajer [Homebrew](https://brew.sh/), kamu brew install kubernetes-cli ``` -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +2. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client ``` -### Instalasi dengan Macports di macOS +### Menginstal dengan Macports pada macOS -Jika kamu menggunakan macOS dan paket manajer [Macports](https://macports.org/), kamu dapat menginstal `kubectl` langsung dengan Macports. +Jika kamu menggunakan macOS dan manajer paket [Macports](https://macports.org/), kamu dapat menginstal `kubectl` langsung dengan Macports. 1. Jalankan perintah: @@ -165,39 +165,39 @@ Jika kamu menggunakan macOS dan paket manajer [Macports](https://macports.org/), sudo port install kubectl ``` -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +2. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client ``` -## Instalasi kubectl di Windows +## Menginstal kubectl pada Windows -### Instalasi binari kubectl dengan curl di Windows +### Menginstal program kubectl dengan curl pada Windows -1. Unduh versi terbaru {{< param "fullversion" >}} dari [tautan ini](https://storage.googleapis.com/kubernetes-release/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl.exe). +1. Unduh versi terbarunya {{< param "fullversion" >}} dari [tautan ini](https://storage.googleapis.com/kubernetes-release/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl.exe). - Atau jika sudah ada `curl`, jalankan perintah ini: + Atau jika sudah ada `curl` pada mesin kamu, jalankan perintah ini: ``` curl -LO https://storage.googleapis.com/kubernetes-release/release/{{< param "fullversion" >}}/bin/windows/amd64/kubectl.exe ``` - Untuk mendapatkan versi stabil terakhir (misal, untuk _scripting_), lihat di [https://storage.googleapis.com/kubernetes-release/release/stable.txt](https://storage.googleapis.com/kubernetes-release/release/stable.txt). + Untuk mendapatkan versi stabil terakhir (misalnya untuk _scripting_), lihat di [https://storage.googleapis.com/kubernetes-release/release/stable.txt](https://storage.googleapis.com/kubernetes-release/release/stable.txt). -1. Tambahkan binary yang sudah diunduh ke PATH komputer. -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +2. Tambahkan program yang sudah diunduh tersebut ke PATH kamu. +3. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client ``` {{< note >}} -[Docker Desktop untuk Windows](https://docs.docker.com/docker-for-windows/#kubernetes) sudah menambahkan versi `kubectl`nya sendiri ke PATH. Jika kamu sudah menginstal Docker Desktop, kamu harus menambahkan _entry_ ke PATH sebelum yang ditambahkan oleh _installer_ Docker Desktop atau kamu dapat menghapus `kubectl` bawaan Docker Desktop. +[Docker Desktop untuk Windows](https://docs.docker.com/docker-for-windows/#kubernetes) sudah menambahkan versi `kubectl`-nya sendiri ke PATH. Jika kamu sudah menginstal Docker Desktop, kamu harus menambahkan entrinya ke PATH sebelum yang ditambahkan oleh penginstal (_installer_) Docker Desktop atau kamu dapat menghapus `kubectl` bawaan dari Docker Desktop. {{< /note >}} -### Instalasi dengan Powershell dari PSGallery +### Menginstal dengan Powershell dari PSGallery -Jika kamu menggunakan Windows dan paket manajer [Powershell Gallery](https://www.powershellgallery.com/), kamu dapat menginstal dan melakukan pembaruan `kubectl` dengan Powershell. +Jika kamu menggunakan Windows dan manajer paket [Powershell Gallery](https://www.powershellgallery.com/), kamu dapat menginstal dan melakukan pembaruan `kubectl` dengan Powershell. 1. Jalankan perintah berikut (jangan lupa untuk memasukkan `DownloadLocation`): @@ -208,9 +208,9 @@ Jika kamu menggunakan Windows dan paket manajer [Powershell Gallery](https://www {{< note >}}Jika kamu tidak menambahkan `DownloadLocation`, `kubectl` akan diinstal di dalam direktori _temp_ pengguna.{{< /note >}} - _Installer_ akan membuat `$HOME/.kube` dan membuat berkas konfigurasi + Penginstal akan membuat `$HOME/.kube` dan membuat berkas konfigurasi -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +2. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client @@ -218,9 +218,9 @@ Jika kamu menggunakan Windows dan paket manajer [Powershell Gallery](https://www {{< note >}}Proses pembaruan dapat dilakukan dengan menjalankan ulang dua perintah yang terdapat pada langkah 1.{{< /note >}} -### Instalasi di Windows menggunaakn Chocolatey atau Scoop +### Menginstal pada Windows menggunakan Chocolatey atau Scoop -Untuk menginstal `kubectl` di Windows kamu dapat menggunakan paket manajer [Chocolatey](https://chocolatey.org) atau _installer_ barisan perintah [Scoop](https://scoop.sh). +Untuk menginstal `kubectl` pada Windows, kamu dapat menggunakan manajer paket [Chocolatey](https://chocolatey.org) atau penginstal baris perintah [Scoop](https://scoop.sh). {{< tabs name="kubectl_win_install" >}} {{% tab name="choco" %}} @@ -233,49 +233,49 @@ Untuk menginstal `kubectl` di Windows kamu dapat menggunakan paket manajer [Choc {{% /tab %}} {{< /tabs >}} -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +1. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client ``` -1. Pindah ke direktori utama: +2. Pindah ke direktori utama: ``` cd %USERPROFILE% ``` -1. Buat direktori `.kube`: +3. Buat direktori `.kube`: ``` mkdir .kube ``` -1. Pindah ke direktori `.kube` yang baru saja dibuat: +4. Pindah ke direktori `.kube` yang baru saja dibuat: ``` cd .kube ``` -1. Lakukan konfigurasi `kubectl` agar menggunakan _remote_ kluster Kubernetes: +5. Lakukan konfigurasi `kubectl` untuk menggunakan klaster Kubernetes _remote_: ``` New-Item config -type file ``` - {{< note >}}Ubah berkas konfigurasi dengan editor teks pilihanmu, misal Notepad.{{< /note >}} + {{< note >}}Ubah berkas konfigurasi dengan penyunting (_editor_) teks pilihanmu, misalnya Notepad.{{< /note >}} -## Unduh dengan menggunakan Google Cloud SDK +## Mengunduh sebagai bagian dari Google Cloud SDK -Kamu dapat menginstal `kubectl` dengan menggunakan Google Cloud SDK. +Kamu dapat menginstal `kubectl` sebagai bagian dari Google Cloud SDK. 1. Instal [Google Cloud SDK](https://cloud.google.com/sdk/). -1. Jalankan perintah instalasi `kubectl`: +2. Jalankan perintah instalasi `kubectl`: ``` gcloud components install kubectl ``` -1. Pastikan instalasi sudah berhasil dengan melakukan pengecekan versi: +3. Pastikan instalasinya sudah berhasil dengan melakukan pengecekan versi: ``` kubectl version --client @@ -283,78 +283,78 @@ Kamu dapat menginstal `kubectl` dengan menggunakan Google Cloud SDK. ## Memeriksa konfigurasi kubectl -Agar `kubectl` dapat mengakses kluster Kubernetes, dibutuhkan sebuah [berkas kubeconfig](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/), yang akan otomatis dibuat ketika kamu membuat kluster baru menggunakan [kube-up.sh](https://github.com/kubernetes/kubernetes/blob/master/cluster/kube-up.sh) atau setelah berhasil men-_deploy_ kluster Minikube. Secara _default_, konfigurasi `kubectl` disimpan di `~/.kube/config`. +Agar `kubectl` dapat mengakses klaster Kubernetes, dibutuhkan sebuah [berkas kubeconfig](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/), yang akan otomatis dibuat ketika kamu membuat klaster baru menggunakan [kube-up.sh](https://github.com/kubernetes/kubernetes/blob/master/cluster/kube-up.sh) atau setelah berhasil men-_deploy_ klaster Minikube. Secara bawaan, konfigurasi `kubectl` disimpan di `~/.kube/config`. -Kamu dapat memeriksa apakah konfigurasi `kubectl` sudah benar dengan mengambil _state_ kluster: +Kamu dapat memeriksa apakah konfigurasi `kubectl` sudah benar dengan mengambil keadaan klaster: ```shell kubectl cluster-info ``` -Jika kamu melihat respons URL maka konfigurasi kluster `kubectl` sudah benar. +Jika kamu melihat respons berupa URL, maka konfigurasi klaster `kubectl` sudah benar. -Tetapi jika kamu melihat pesan seperti di bawah maka `kubectl` belum dikonfigurasi dengan benar atau tidak dapat terhubung ke kluster Kubernetes. +Tetapi, jika kamu melihat pesan seperti di bawah, maka `kubectl` belum dikonfigurasi dengan benar atau tidak dapat terhubung ke klaster Kubernetes. ```shell The connection to the server was refused - did you specify the right host or port? ``` -Selanjutnya, apabila kamu ingin menjalankan kluster Kubernetes di laptop (lokal), kamu memerlukan sebuah perangkat seperti Minikube sebelum menjalankan ulang perintah yang ada di atas. +Selanjutnya, jika kamu ingin menjalankan klaster Kubernetes di laptop (lokal) kamu, kamu memerlukan sebuah perangkat seperti Minikube sebelum menjalankan ulang perintah yang ada di atas. -Jika `kubectl cluster-info` mengembalikan respons URL tetapi kamu masih belum dapat mengakses ke kluster, kamu bisa menggunakan perintah di bawah untuk memeriksa apakah kluster sudah dikonfigurasi dengan benar. +Jika `kubectl cluster-info` mengembalikan respons URL tetapi kamu masih belum dapat mengakses klaster, kamu bisa menggunakan perintah di bawah untuk memeriksa apakah klaster sudah dikonfigurasi dengan benar. ```shell kubectl cluster-info dump ``` -## Konfigurasi kubectl yang dapat dilakukan +## Konfigurasi kubectl opsional -### Menyalakan _auto complete_ untuk terminal +### Menyalakan penyelesaian otomatis untuk terminal -`kubectl` menyediakan fitur _auto complete_ untuk Bash dan Zsh yang dapat memudahkanmu ketika mengetik di terminal. +`kubectl` menyediakan fitur penyelesaian otomatis (_auto complete_) untuk Bash dan Zsh yang dapat memudahkanmu ketika mengetik di terminal. -Ikuti petunjuk di bawah untuk menyalakan _auto complete_ untuk Bash dan Zsh. +Ikuti petunjuk di bawah untuk menyalakan penyelesaian otomatis untuk Bash dan Zsh. {{< tabs name="kubectl_autocompletion" >}} -{{% tab name="Bash di Linux" %}} +{{% tab name="Bash pada Linux" %}} ### Pendahuluan -_Completion script_ `kubectl` untuk Bash dapat dibuat dengan perintah `kubectl completion bash`. Masukkan skrip tersebut ke dalam terminal sebagai sumber untuk menyalakan _auto complete_ dari `kubectl`. +Skrip penyelesaian (_completion script_) `kubectl` untuk Bash dapat dibuat dengan perintah `kubectl completion bash`. Masukkan skrip tersebut ke dalam terminal sebagai sumber untuk menyalakan penyelesaian otomatis dari `kubectl`. -Namun, _completion script_ tersebut tergantung dengan [**bash-completion**](https://github.com/scop/bash-completion), yang artinya kamu harus menginstal program tersebut terlebih dahulu (kamu dapat memeriksa apakah kamu sudah memiliki bash-completion dengan menjalankan perintah `type _init_completion`). +Namun, skrip penyelesaian tersebut bergantung pada [**bash-completion**](https://github.com/scop/bash-completion), yang artinya kamu harus menginstal program tersebut terlebih dahulu (kamu dapat memeriksa apakah kamu sudah memiliki bash-completion dengan menjalankan perintah `type _init_completion`). -### Instalasi bash-completion +### Menginstal bash-completion -bash-completion disediakan oleh banyak manajer paket (lihat [di sini](https://github.com/scop/bash-completion#installation)). Kamu dapat menginstalnya dengan menggunakan perintah `apt-get install bash-completion` atau `yum install bash-completion`, atau dsb. +bash-completion disediakan oleh banyak manajer paket (lihat [di sini](https://github.com/scop/bash-completion#installation)). Kamu dapat menginstalnya dengan menggunakan perintah `apt-get install bash-completion` atau `yum install bash-completion`, dsb. -Perintah di atas akan membuat skrip utama bash-completion di `/usr/share/bash-completion/bash_completion`. Terkadang kamu juga harus menambahkan skrip tersebut ke dalam berkas `~/.bashrc`, tergantung paket manajer yang kamu pakai. +Perintah di atas akan membuat skrip utama bash-completion di `/usr/share/bash-completion/bash_completion`. Terkadang kamu juga harus menambahkan skrip tersebut ke dalam berkas `~/.bashrc`, tergantung manajer paket yang kamu pakai. -Untuk memastikan, muat ulang terminalmu dan jalankan `type _init_completion`. Jika perintah berhasil maka instalasi selesai. Jika tidak, tambahkan teks berikut ke dalam berkas `~/.bashrc`: +Untuk memastikannya, muat ulang terminalmu dan jalankan `type _init_completion`. Jika perintah tersebut berhasil, maka instalasi selesai. Jika tidak, tambahkan teks berikut ke dalam berkas `~/.bashrc`: ```shell source /usr/share/bash-completion/bash_completion ``` -Muat ulang lagi terminalmu dan pastikan bash-completion sudah berhasil diinstal dengan menjalankan `type _init_completion`. +Muat ulang terminalmu dan pastikan bash-completion sudah berhasil diinstal dengan menjalankan `type _init_completion`. -### Menyalakan _auto complete_ kubectl +### Menyalakan penyelesaian otomatis kubectl -Sekarang kamu harus memastikan bahwa _completion script_ untuk `kubectl` sudah dimasukkan sebagai sumber _auto complete_ di semua sesi terminal. Kamu dapat melakukannya dengan dua cara: +Sekarang kamu harus memastikan bahwa skrip penyelesaian untuk `kubectl` sudah dimasukkan sebagai sumber penyelesaian otomatis pada semua sesi terminal. Kamu dapat melakukannya dengan dua cara: -- Masukkan _completion script_ sebagai sumber di berkas `~/.bashrc`: +- Masukkan skrip penyelesaian sebagai sumber di berkas `~/.bashrc`: ```shell echo 'source <(kubectl completion bash)' >>~/.bashrc ``` -- Menambahkan _completion script_ ke direktori `/etc/bash_completion.d`: +- Tambahkan skrip penyelesaian ke direktori `/etc/bash_completion.d`: ```shell kubectl completion bash >/etc/bash_completion.d/kubectl ``` -Jika kamu menggunakan alias untuk `kubectl`, kamu masih dapat menggunakan fitur _auto complete_ dengan menjalankan perintah: +Jika kamu menggunakan alias untuk `kubectl`, kamu masih dapat menggunakan fitur penyelesaian otomatis dengan menjalankan perintah: ```shell echo 'alias k=kubectl' >>~/.bashrc @@ -362,28 +362,28 @@ Jika kamu menggunakan alias untuk `kubectl`, kamu masih dapat menggunakan fitur ``` {{< note >}} -Semua sumber _completion script_ bash-completion terdapat di `/etc/bash_completion.d`. +Semua sumber skrip penyelesaian bash-completion terdapat di `/etc/bash_completion.d`. {{< /note >}} -Kedua cara tersebut sama, kamu bisa mengambil salah satu cara saja. Setelah memuat ulang terminal, _auto complete_ dari `kubectl` seharusnya sudah dapat bekerja. +Kedua cara tersebut sama, kamu bisa memilih salah satunya. Setelah memuat ulang terminal, penyelesaian otomatis dari `kubectl` seharusnya sudah dapat bekerja. {{% /tab %}} -{{% tab name="Bash di macOS" %}} +{{% tab name="Bash pada macOS" %}} ### Pendahuluan -_Completion script_ `kubectl` untuk Bash dapat dibuat dengan perintah `kubectl completion bash`. Masukkan skrip tersebut ke dalam terminal sebagai sumber untuk menyalakan _auto complete_ dari `kubectl`. +Skrip penyelesaian (_completion script_) `kubectl` untuk Bash dapat dibuat dengan perintah `kubectl completion bash`. Masukkan skrip tersebut ke dalam terminal sebagai sumber untuk menyalakan penyelesaian otomatis dari `kubectl`. -Namun, _completion script_ tersebut tergantung dengan [**bash-completion**](https://github.com/scop/bash-completion), yang artinya kamu harus menginstal program tersebut terlebih dahulu. +Namun, skrip penyelesaian tersebut bergantung pada [**bash-completion**](https://github.com/scop/bash-completion), yang artinya kamu harus menginstal program tersebut terlebih dahulu. {{< warning>}} -Terdapat dua versi bash-completion, v1 dan v2. V1 untuk Bash 3.2 (_default_ dari macOs), dan v2 untuk Bash 4.1+. _Completion script_ `kubectl` **tidak kompatibel** dengan bash-completion v1 dan Bash 3.2. Dibutuhkan **bash-completion v2** dan **Bash 4.1+** agar _completion script_ `kubectl` dapat bekerja dengan baik. Maka dari itu, kamu harus menginstal dan menggunakan Bash 4.1+ ([*panduan*](https://itnext.io/upgrading-bash-on-macos-7138bd1066ba)) untuk dapat menggunakan fitur _auto complete_ dari `kubectl`. Ikuti panduan di bawah setelah kamu menginstal Bash 4.1+ (yang artinya Bash versi 4.1 atau lebih baru). +Terdapat dua versi bash-completion, v1 dan v2. V1 untuk Bash 3.2 (bawaan dari macOs), dan v2 untuk Bash 4.1+. Skrip penyelesaian `kubectl` **tidak kompatibel** dengan bash-completion v1 dan Bash 3.2. Dibutuhkan **bash-completion v2** dan **Bash 4.1+** agar skrip penyelesaian `kubectl` dapat bekerja dengan baik. Maka dari itu, kamu harus menginstal dan menggunakan Bash 4.1+ ([*panduan*](https://itnext.io/upgrading-bash-on-macos-7138bd1066ba)) untuk dapat menggunakan fitur penyelesaian otomatis dari `kubectl`. Ikuti panduan di bawah setelah kamu menginstal Bash 4.1+ (yaitu, Bash versi 4.1 atau lebih baru). {{< /warning >}} -### Pembaruan Bash +### Pemutakhiran Bash Panduan di bawah berasumsi kamu menggunakan Bash 4.1+. Kamu dapat memeriksa versi Bash dengan menjalankan: @@ -391,7 +391,7 @@ Panduan di bawah berasumsi kamu menggunakan Bash 4.1+. Kamu dapat memeriksa vers echo $BASH_VERSION ``` -Jika versinya sudah terlalu usang, kamu dapat menginstal/memperbaruinya dengan menggunakan Homebrew: +Jika versinya sudah terlalu usang, kamu dapat menginstal/memutakhirkannya dengan menggunakan Homebrew: ```shell brew install bash @@ -405,10 +405,10 @@ echo $BASH_VERSION $SHELL Homebrew biasanya akan menginstalnya di `/usr/local/bin/bash`. -### Instalasi bash-completion +### Menginstal bash-completion {{< note >}} -Seperti yang sudah disebutkan, panduan di bawah berasumsi kamu menggunakan Bash 4.1+, yang berarti kamu akan menginstal bash-completion v2 (_auto complete_ dari `kubectl` tidak kompatibel dengan Bash 3.2 dan bash-completion v1). +Seperti yang sudah disebutkan, panduan di bawah berasumsi kamu menggunakan Bash 4.1+, yang berarti kamu akan menginstal bash-completion v2 (penyelesaian otomatis dari `kubectl` tidak kompatibel dengan Bash 3.2 dan bash-completion v1). {{< /note >}} Kamu dapat memeriksa apakah kamu sudah memiliki bash-completion v2 dengan perintah `type _init_completion`. Jika belum, kamu dapat menginstalnya dengan menggunakan Homebrew: @@ -417,7 +417,7 @@ Kamu dapat memeriksa apakah kamu sudah memiliki bash-completion v2 dengan perint brew install bash-completion@2 ``` -Seperti yang disarankan keluaran perintah di atas, tambahkan teks berikut ke berkas `~/.bashrc`: +Seperti yang disarankan pada keluaran perintah di atas, tambahkan teks berikut ke berkas `~/.bashrc`: ```shell export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" @@ -426,55 +426,55 @@ export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" Muat ulang terminalmu dan pastikan bash-completion v2 sudah terinstal dengan perintah `type _init_completion`. -### Menyalakan _auto complete_ kubectl +### Menyalakan penyelesaian otomatis kubectl -Sekarang kamu harus memastikan bahwa _completion script_ untuk `kubectl` sudah dimasukkan sebagai sumber _auto complete_ di semua sesi terminal. Kamu dapat melakukannya dengan beberapa cara: +Sekarang kamu harus memastikan bahwa skrip penyelesaian untuk `kubectl` sudah dimasukkan sebagai sumber penyelesaian otomatis di semua sesi terminal. Kamu dapat melakukannya dengan beberapa cara: -- Masukkan _completion script_ sebagai sumber di berkas `~/.bashrc`: +- Masukkan skrip penyelesaian sebagai sumber di berkas `~/.bashrc`: ```shell echo 'source <(kubectl completion bash)' >>~/.bashrc ``` -- Menambahkan _completion script_ ke direktori `/etc/bash_completion.d`: +- Menambahkan skrip penyelesaian ke direktori `/etc/bash_completion.d`: ```shell kubectl completion bash >/etc/bash_completion.d/kubectl ``` -- Jika kamu menggunakan alias untuk `kubectl`, kamu masih dapat menggunakan fitur _auto complete_ dengan menjalankan perintah: +- Jika kamu menggunakan alias untuk `kubectl`, kamu masih dapat menggunakan fitur penyelesaian otomatis dengan menjalankan perintah: ```shell echo 'alias k=kubectl' >>~/.bashrc echo 'complete -F __start_kubectl k' >>~/.bashrc ``` -- Jika kamu menginstal `kubectl` dengan Homebrew (seperti yang sudah dijelaskan [di atas](#install-with-homebrew-on-macos)), maka _completion script_ untuk `kubectl` sudah berada di `/usr/local/etc/bash_completion.d/kubectl`. Kamu tidak perlu melakukan apa-apa lagi. +- Jika kamu menginstal `kubectl` dengan Homebrew (seperti yang sudah dijelaskan [di atas](#install-with-homebrew-on-macos)), maka skrip penyelesaian untuk `kubectl` sudah berada di `/usr/local/etc/bash_completion.d/kubectl`. Kamu tidak perlu melakukan apa-apa lagi. {{< note >}} -bash-completion v2 yang diinstal dengan Homebrew meletakkan semua berkas nya di direktori `BASH_COMPLETION_COMPAT_DIR`, yang membuat dua cara terakhir dapat bekerja. +bash-completion v2 yang diinstal dengan Homebrew meletakkan semua berkas nya di direktori `BASH_COMPLETION_COMPAT_DIR`, itulah alasannya dua cara terakhir dapat bekerja. {{< /note >}} -Setelah memuat ulang terminal, _auto complete_ dari `kubectl` seharusnya sudah dapat bekerja. +Setelah memuat ulang terminal, penyelesaian otomatis dari `kubectl` seharusnya sudah dapat bekerja. {{% /tab %}} {{% tab name="Zsh" %}} -_Completion script_ `kubectl` untuk Zsh dapat dibuat dengan perintah `kubectl completion zsh`. Masukkan skrip tersebut ke dalam terminal sebagai sumber untuk menyalakan _auto complete_ dari `kubectl`. +Skrip penyelesaian (_completion script_) `kubectl` untuk Zsh dapat dibuat dengan perintah `kubectl completion zsh`. Masukkan skrip tersebut ke dalam terminal sebagai sumber untuk menyalakan penyelesaian otomatis dari `kubectl`. -Tambahkan baris berikut di berkas `~/.zshrc` untuk menyalakan _auto complete_ dari `kubectl`: +Tambahkan baris berikut di berkas `~/.zshrc` untuk menyalakan penyelesaian otomatis dari `kubectl`: ```shell source <(kubectl completion zsh) ``` -Jika kamu menggunakan alias untuk `kubectl`, kamu masih dapat menggunakan fitur _auto complete_ dengan menjalankan perintah: +Jika kamu menggunakan alias untuk `kubectl`, kamu masih dapat menggunakan fitur penyelesaian otomatis dengan menjalankan perintah: ```shell echo 'alias k=kubectl' >>~/.zshrc echo 'complete -F __start_kubectl k' >>~/.zshrc ``` -Setelah memuat ulang terminal, _auto complete_ dari `kubectl` seharusnya sudah dapat bekerja. +Setelah memuat ulang terminal, penyelesaian otomatis dari `kubectl` seharusnya sudah dapat bekerja. Jika kamu mendapatkan pesan gagal seperti `complete:13: command not found: compdef`, maka tambahkan teks berikut ke awal berkas `~/.zshrc`: @@ -488,9 +488,9 @@ compinit {{% /capture %}} {{% capture whatsnext %}} -* [Instalasi Minikube](/docs/tasks/tools/install-minikube/) -* Lihat [panduan memulai](/docs/setup/) untuk mencari tahu tentang pembuatan kluster. +* [Menginstal Minikube.](/docs/tasks/tools/install-minikube/) +* Lihat [panduan persiapan](/docs/setup/) untuk mencari tahu tentang pembuatan klaster. * [Pelajari cara untuk menjalankan dan mengekspos aplikasimu.](/docs/tasks/access-application-cluster/service-access-application-cluster/) -* Jika kamu membutuhkan akses ke kluster yang tidak kamu buat, lihat [dokumen Sharing Cluster Access](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/). +* Jika kamu membutuhkan akses ke klaster yang tidak kamu buat, lihat [dokumen Berbagi Akses Klaster](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/). * Baca [dokumen referensi kubectl](/docs/reference/kubectl/kubectl/) {{% /capture %}} From 58498dc3ca5e300458a2fbdad822c4c6c6410961 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Fri, 27 Dec 2019 18:38:37 +0000 Subject: [PATCH 07/67] Reword PodPreset concept - Note feature state for PodPreset - Emphasize section on enabling PodPreset - Omit version check Assume that the reader has a supported version of Kubernetes that includes PodPreset. - List PodPreset as a task prerequisite PodPreset is an alpha feature; you can't follow the task page unless it's enabled. --- .../docs/concepts/workloads/pods/podpreset.md | 57 ++++++++++--------- .../inject-data-application/podpreset.md | 7 ++- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/content/en/docs/concepts/workloads/pods/podpreset.md b/content/en/docs/concepts/workloads/pods/podpreset.md index 876ba995c9..a1906c8b99 100644 --- a/content/en/docs/concepts/workloads/pods/podpreset.md +++ b/content/en/docs/concepts/workloads/pods/podpreset.md @@ -7,6 +7,8 @@ weight: 50 --- {{% capture overview %}} +{{< feature-state for_k8s_version="v1.6" state="alpha" >}} + This page provides an overview of PodPresets, which are objects for injecting certain information into pods at creation time. The information can include secrets, volumes, volume mounts, and environment variables. @@ -14,20 +16,38 @@ secrets, volumes, volume mounts, and environment variables. {{% capture body %}} -## Understanding Pod Presets +## Understanding Pod presets -A `Pod Preset` is an API resource for injecting additional runtime requirements +A PodPreset is an API resource for injecting additional runtime requirements into a Pod at creation time. You use [label selectors](/docs/concepts/overview/working-with-objects/labels/#label-selectors) -to specify the Pods to which a given Pod Preset applies. +to specify the Pods to which a given PodPreset applies. -Using a Pod Preset allows pod template authors to not have to explicitly provide +Using a PodPreset allows pod template authors to not have to explicitly provide all information for every pod. This way, authors of pod templates consuming a specific service do not need to know all the details about that service. -For more information about the background, see the [design proposal for PodPreset](https://git.k8s.io/community/contributors/design-proposals/service-catalog/pod-preset.md). -## How It Works +## Enable PodPreset in your cluster {#enable-pod-preset} + +In order to use Pod presets in your cluster you must ensure the following: + +1. You have enabled the API type `settings.k8s.io/v1alpha1/podpreset`. For + example, this can be done by including `settings.k8s.io/v1alpha1=true` in + the `--runtime-config` option for the API server. In minikube add this flag + `--extra-config=apiserver.runtime-config=settings.k8s.io/v1alpha1=true` while + starting the cluster. +1. You have enabled the admission controller `PodPreset`. One way to doing this + is to include `PodPreset` in the `--enable-admission-plugins` option value specified + for the API server. In minikube, add this flag + + ```shell + --extra-config=apiserver.enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,PodPreset + ``` + + while starting the cluster. + +## How it works Kubernetes provides an admission controller (`PodPreset`) which, when enabled, applies Pod Presets to incoming pod creation requests. @@ -62,31 +82,12 @@ There may be instances where you wish for a Pod to not be altered by any Pod Preset mutations. In these cases, you can add an annotation in the Pod Spec of the form: `podpreset.admission.kubernetes.io/exclude: "true"`. -## Enable Pod Preset - -In order to use Pod Presets in your cluster you must ensure the following: - -1. You have enabled the API type `settings.k8s.io/v1alpha1/podpreset`. For - example, this can be done by including `settings.k8s.io/v1alpha1=true` in - the `--runtime-config` option for the API server. In minikube add this flag - `--extra-config=apiserver.runtime-config=settings.k8s.io/v1alpha1=true` while - starting the cluster. -1. You have enabled the admission controller `PodPreset`. One way to doing this - is to include `PodPreset` in the `--enable-admission-plugins` option value specified - for the API server. In minikube add this flag - - ```shell - --extra-config=apiserver.enable-admission-plugins=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,PodPreset - ``` - - while starting the cluster. -1. You have defined your Pod Presets by creating `PodPreset` objects in the - namespace you will use. - {{% /capture %}} {{% capture whatsnext %}} -* [Injecting data into a Pod using PodPreset](/docs/tasks/inject-data-application/podpreset/) +See [Injecting data into a Pod using PodPreset](/docs/tasks/inject-data-application/podpreset/) + +For more information about the background, see the [design proposal for PodPreset](https://git.k8s.io/community/contributors/design-proposals/service-catalog/pod-preset.md). {{% /capture %}} diff --git a/content/en/docs/tasks/inject-data-application/podpreset.md b/content/en/docs/tasks/inject-data-application/podpreset.md index de41c0f73a..dcf159acf5 100644 --- a/content/en/docs/tasks/inject-data-application/podpreset.md +++ b/content/en/docs/tasks/inject-data-application/podpreset.md @@ -2,20 +2,23 @@ reviewers: - jessfraz title: Inject Information into Pods Using a PodPreset -min-kubernetes-server-version: v1.10 +min-kubernetes-server-version: v1.6 content_template: templates/task weight: 60 --- {{% capture overview %}} +{{< feature-state for_k8s_version="v1.6" state="alpha" >}} + This page shows how to use PodPreset objects to inject information like {{< glossary_tooltip text="Secrets" term_id="secret" >}}, volume mounts, and {{< glossary_tooltip text="environment variables" term_id="container-env-variables" >}} into Pods at creation time. {{% /capture %}} {{% capture prerequisites %}} -{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} +You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one using [Minikube](/docs/setup/learning-environment/minikube/). +Make sure that you have [enabled PodPreset](/docs/concepts/workloads/pods/podpreset/#enable-pod-preset) in your cluster. {{% /capture %}} From c44e025d8dd1c656fedbbdc336462d0a0d6bc929 Mon Sep 17 00:00:00 2001 From: Aapeli Date: Tue, 28 Apr 2020 08:53:40 +1000 Subject: [PATCH 08/67] Fix typo in content/en/docs/concepts/services-networking/service.md --- content/en/docs/concepts/services-networking/service.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/concepts/services-networking/service.md b/content/en/docs/concepts/services-networking/service.md index 92654fc612..acc72b9d8a 100644 --- a/content/en/docs/concepts/services-networking/service.md +++ b/content/en/docs/concepts/services-networking/service.md @@ -311,8 +311,8 @@ these are: - `nq`: never queue {{< note >}} -To run kube-proxy in IPVS mode, you must make the IPVS Linux available on -the node before you starting kube-proxy. +To run kube-proxy in IPVS mode, you must make IPVS available on +the node before starting kube-proxy. When kube-proxy starts in IPVS proxy mode, it verifies whether IPVS kernel modules are available. If the IPVS kernel modules are not detected, then kube-proxy From c5abd7704a218ffc096015d2c4ee65d4f5819bf4 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Sat, 9 Nov 2019 15:37:02 +0000 Subject: [PATCH 09/67] Improve Node, Taints, and Tolerations concepts - Use glossary shortcodes in Node concept Add glossary tooltips to help new readers take in unfamiliar concepts. - Move minion hint to glossary The page about Node need not mention the former name (minion): it has been many releases since the name change. Instead, add a hint to the full glossary definition. - Use note shortcodes where appropriate - Order node management section first in concept page - Drop list of components that act on Nodes With Operators and CustomResourceDefinitions now common, plus the cluster API, it's less easy to give a definitive list of components that interacr with Node objects. - Tidy old mentions of GA features for Node - Give node tainting by condition its own section - Introduce toleration concept before using it - Mention version in TopologyManager feature state - Other rewording - Tidy Node condition table - Explain SchedulingDisabled synthesized condition - Drop details of supported versions for NodeRestriction Assume that cluster version is v1.13 or later --- .../en/docs/concepts/architecture/nodes.md | 317 ++++++++++-------- .../configuration/taint-and-toleration.md | 76 ++--- .../en/docs/concepts/overview/components.md | 2 +- content/en/docs/reference/glossary/node.md | 2 + 4 files changed, 212 insertions(+), 185 deletions(-) diff --git a/content/en/docs/concepts/architecture/nodes.md b/content/en/docs/concepts/architecture/nodes.md index 6e62881451..e18ef8faa4 100644 --- a/content/en/docs/concepts/architecture/nodes.md +++ b/content/en/docs/concepts/architecture/nodes.md @@ -9,32 +9,132 @@ weight: 10 {{% capture overview %}} -A node is a worker machine in Kubernetes, previously known as a `minion`. A node -may be a VM or physical machine, depending on the cluster. Each node contains -the services necessary to run [pods](/docs/concepts/workloads/pods/pod/) and is managed by the master -components. The services on a node include the [container runtime](/docs/concepts/overview/components/#container-runtime), kubelet and kube-proxy. See -[The Kubernetes Node](https://git.k8s.io/community/contributors/design-proposals/architecture/architecture.md#the-kubernetes-node) section in the -architecture design doc for more details. +Kubernetes runs your workload by placing containers into Pods to run on _Nodes_. +A node may be a virtual or physical machine, depending on the cluster. Each node +contains the services necessary to run +{{< glossary_tooltip text="Pods" term_id="pod" >}}, managed by the +{{< glossary_tooltip text="control plane" term_id="control-plane" >}}. + +Typically you have several nodes in a cluster; in a learning or resource-limited +environment, you might have just one. + +The [components](/docs/concepts/overview/components/#node-components) on a node include the +{{< glossary_tooltip text="kubelet" term_id="kubelet" >}}, a +{{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}, and the +{{< glossary_tooltip text="kube-proxy" term_id="kube-proxy" >}}. {{% /capture %}} - {{% capture body %}} -## Node Status +## Management -A node's status contains the following information: +There are two main ways to have Nodes added to the {{< glossary_tooltip text="API server" term_id="kube-apiserver" >}}: + +1. The kubelet on a node self-registers to the control plane +2. You, or another human user, manually add a Node object + +After you create a Node object, or the kubelet on a node self-registers, the +control plane checks whether the new Node object is valid. For example, if you +try to create a Node from the following JSON manifest: + +```json +{ + "kind": "Node", + "apiVersion": "v1", + "metadata": { + "name": "10.240.79.157", + "labels": { + "name": "my-first-k8s-node" + } + } +} +``` + +Kubernetes creates a Node object internally (the representation). Kubernetes checks +that a kubelet has registered to the API server that matches the `metadata.name` +field of the Node. If the node is healthy (if all necessary services are running), +it is eligible to run a Pod. Otherwise, that node is ignored for any cluster activity +until it becomes healthy. + +{{< note >}} +Kubernetes keeps the object for the invalid Node and continues checking to see whether +it becomes healthy. + +You, or a {{< glossary_tooltip term_id="controller" text="controller">}}, must explicitly +delete the Node object to stop that health checking. +{{< /note >}} + +The name of a Node object must be a valid +[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names). + +### Self-registration of Nodes + +When the kubelet flag `--register-node` is true (the default), the kubelet will attempt to +register itself with the API server. This is the preferred pattern, used by most distros. + +For self-registration, the kubelet is started with the following options: + + - `--kubeconfig` - Path to credentials to authenticate itself to the API server. + - `--cloud-provider` - How to talk to a {{< glossary_tooltip text="cloud provider" term_id="cloud-provider" >}} to read metadata about itself. + - `--register-node` - Automatically register with the API server. + - `--register-with-taints` - Register the node with the given list of {{< glossary_tooltip text="taints" term_id="taint" >}} (comma separated `=:`). + + No-op if `register-node` is false. + - `--node-ip` - IP address of the node. + - `--node-labels` - {{< glossary_tooltip text="Labels" term_id="label" >}} to add when registering the node in the cluster (see label restrictions enforced by the [NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction)). + - `--node-status-update-frequency` - Specifies how often kubelet posts node status to master. + +When the [Node authorization mode](/docs/reference/access-authn-authz/node/) and +[NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction) are enabled, +kubelets are only authorized to create/modify their own Node resource. + +### Manual Node administration + +You can create and modify Node objects using +{{< glossary_tooltip text="kubectl" term_id="kubectl" >}}. + +When you want to create Node objects manually, set the kubelet flag `--register-node=false`. + +You can modify Node objects regardless of the setting of `--register-node`. +For example, you can set labels on an existing Node, or mark it unschedulable. + +You can use labels on Nodes in conjunction with node selectors on Pods to control +scheduling. For example, you can to constrain a Pod to only be eligible to run on +a subset of the available nodes. + +Marking a node as unschedulable prevents the scheduler from placing new pods onto +that Node, but does not affect existing Pods on the Node. This is useful as a +preparatory step before a node reboot or other maintenance. + +To mark a Node unschedulable, run: + +```shell +kubectl cordon $NODENAME +``` + +{{< note >}} +Pods that are part of a {{< glossary_tooltip term_id="daemonset" >}} tolerate +being run on an unschedulable Node. DaemonSets typically provide node-local services +that should run on the Node even if it is being drained of workload applications. +{{< /note >}} + +## Node status + +A Node's status contains the following information: * [Addresses](#addresses) * [Conditions](#condition) * [Capacity and Allocatable](#capacity) * [Info](#info) -Node status and other details about a node can be displayed using the following command: +You can use `kubectl` to view a Node's status and other details: + ```shell kubectl describe node ``` -Each section is described in detail below. + +Each section of the output is described below. ### Addresses @@ -49,15 +149,23 @@ The usage of these fields varies depending on your cloud provider or bare metal The `conditions` field describes the status of all `Running` nodes. Examples of conditions include: -| Node Condition | Description | -|----------------|-------------| -| `Ready` | `True` if the node is healthy and ready to accept pods, `False` if the node is not healthy and is not accepting pods, and `Unknown` if the node controller has not heard from the node in the last `node-monitor-grace-period` (default is 40 seconds) | -| `MemoryPressure` | `True` if pressure exists on the node memory -- that is, if the node memory is low; otherwise `False` | -| `PIDPressure` | `True` if pressure exists on the processes -- that is, if there are too many processes on the node; otherwise `False` | -| `DiskPressure` | `True` if pressure exists on the disk size -- that is, if the disk capacity is low; otherwise `False` | -| `NetworkUnavailable` | `True` if the network for the node is not correctly configured, otherwise `False` | +{{< table caption = "Node conditions, and a description of when each condition applies." >}} +| Node Condition | Description | +|----------------------|-------------| +| `Ready` | `True` if the node is healthy and ready to accept pods, `False` if the node is not healthy and is not accepting pods, and `Unknown` if the node controller has not heard from the node in the last `node-monitor-grace-period` (default is 40 seconds) | +| `DiskPressure` | `True` if pressure exists on the disk size--that is, if the disk capacity is low; otherwise `False` | +| `MemoryPressure` | `True` if pressure exists on the node memory--that is, if the node memory is low; otherwise `False` | +| `PIDPressure` | `True` if pressure exists on the processes—that is, if there are too many processes on the node; otherwise `False` | +| `NetworkUnavailable` | `True` if the network for the node is not correctly configured, otherwise `False` | +{{< /table >}} -The node condition is represented as a JSON object. For example, the following response describes a healthy node. +{{< note >}} +If you use command-line tools to print details of a cordoned Node, the Condition includes +`SchedulingDisabled`. `SchedulingDisabled` is not a Condition in the Kubernetes API; instead, +cordoned nodes are marked Unschedulable in their spec. +{{< /note >}} + +The node condition is represented as a JSON object. For example, the following structure describes a healthy node: ```json "conditions": [ @@ -72,20 +180,24 @@ The node condition is represented as a JSON object. For example, the following r ] ``` -If the Status of the Ready condition remains `Unknown` or `False` for longer than the `pod-eviction-timeout` (an argument passed to the [kube-controller-manager](/docs/admin/kube-controller-manager/)), all the Pods on the node are scheduled for deletion by the Node Controller. The default eviction timeout duration is **five minutes**. In some cases when the node is unreachable, the apiserver is unable to communicate with the kubelet on the node. The decision to delete the pods cannot be communicated to the kubelet until communication with the apiserver is re-established. In the meantime, the pods that are scheduled for deletion may continue to run on the partitioned node. +If the Status of the Ready condition remains `Unknown` or `False` for longer than the `pod-eviction-timeout` (an argument passed to the {{< glossary_tooltip text="kube-controller-manager" term_id="kube-controller-manager" >}}), all the Pods on the node are scheduled for deletion by the node controller. The default eviction timeout duration is **five minutes**. In some cases when the node is unreachable, the API server is unable to communicate with the kubelet on the node. The decision to delete the pods cannot be communicated to the kubelet until communication with the API server is re-established. In the meantime, the pods that are scheduled for deletion may continue to run on the partitioned node. -In versions of Kubernetes prior to 1.5, the node controller would [force delete](/docs/concepts/workloads/pods/pod/#force-deletion-of-pods) -these unreachable pods from the apiserver. However, in 1.5 and higher, the node controller does not force delete pods until it is -confirmed that they have stopped running in the cluster. You can see the pods that might be running on an unreachable node as being in -the `Terminating` or `Unknown` state. In cases where Kubernetes cannot deduce from the underlying infrastructure if a node has -permanently left a cluster, the cluster administrator may need to delete the node object by hand. Deleting the node object from -Kubernetes causes all the Pod objects running on the node to be deleted from the apiserver, and frees up their names. +The node controller does not force delete pods until it is confirmed that they have stopped +running in the cluster. You can see the pods that might be running on an unreachable node as +being in the `Terminating` or `Unknown` state. In cases where Kubernetes cannot deduce from the +underlying infrastructure if a node has permanently left a cluster, the cluster administrator +may need to delete the node object by hand. Deleting the node object from Kubernetes causes +all the Pod objects running on the node to be deleted from the API server, and frees up their +names. The node lifecycle controller automatically creates [taints](/docs/concepts/configuration/taint-and-toleration/) that represent conditions. The scheduler takes the Node's taints into consideration when assigning a Pod to a Node. Pods can also have tolerations which let them tolerate a Node's taints. +See [Taint Nodes by Condition](/docs/concepts/configuration/taint-and-toleration/#taint-nodes-by-condition) +for more details. + ### Capacity and Allocatable {#capacity} Describes the resources available on the node: CPU, memory and the maximum @@ -104,48 +216,10 @@ on a Node. Describes general information about the node, such as kernel version, Kubernetes version (kubelet and kube-proxy version), Docker version (if used), and OS name. This information is gathered by Kubelet from the node. -## Management +### Node controller -Unlike [pods](/docs/concepts/workloads/pods/pod/) and [services](/docs/concepts/services-networking/service/), -a node is not inherently created by Kubernetes: it is created externally by cloud -providers like Google Compute Engine, or it exists in your pool of physical or virtual -machines. So when Kubernetes creates a node, it creates -an object that represents the node. After creation, Kubernetes -checks whether the node is valid or not. For example, if you try to create -a node from the following content: - -```json -{ - "kind": "Node", - "apiVersion": "v1", - "metadata": { - "name": "10.240.79.157", - "labels": { - "name": "my-first-k8s-node" - } - } -} -``` - -Kubernetes creates a node object internally (the representation), and -validates the node by health checking based on the `metadata.name` field. If the node is valid -- that is, if all necessary -services are running -- it is eligible to run a pod. Otherwise, it is -ignored for any cluster activity until it becomes valid. -The name of a Node object must be a valid -[DNS subdomain name](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names). - -{{< note >}} -Kubernetes keeps the object for the invalid node and keeps checking to see whether it becomes valid. -You must explicitly delete the Node object to stop this process. -{{< /note >}} - -Currently, there are three components that interact with the Kubernetes node -interface: node controller, kubelet, and kubectl. - -### Node Controller - -The node controller is a Kubernetes master component which manages various -aspects of nodes. +The node {{< glossary_tooltip text="controller" term_id="controller" >}} is a +Kubernetes control plane component that manages various aspects of nodes. The node controller has multiple roles in a node's life. The first is assigning a CIDR block to the node when it is registered (if CIDR assignment is turned on). @@ -168,6 +242,7 @@ checks the state of each node every `--node-monitor-period` seconds. #### Heartbeats Heartbeats, sent by Kubernetes nodes, help determine the availability of a node. + There are two forms of heartbeats: updates of `NodeStatus` and the [Lease object](/docs/reference/generated/kubernetes-api/{{< latest-version >}}/#lease-v1-coordination-k8s-io). Each Node has an associated Lease object in the `kube-node-lease` @@ -188,13 +263,7 @@ a Lease object. #### Reliability -In Kubernetes 1.4, we updated the logic of the node controller to better handle -cases when a large number of nodes have problems with reaching the master -(e.g. because the master has networking problems). Starting with 1.4, the node -controller looks at the state of all nodes in the cluster when making a -decision about pod eviction. - -In most cases, node controller limits the eviction rate to + In most cases, node controller limits the eviction rate to `--node-eviction-rate` (default 0.1) per second, meaning it won't evict pods from more than 1 node per 10 seconds. @@ -220,62 +289,12 @@ completely unhealthy (i.e. there are no healthy nodes in the cluster). In such a case, the node controller assumes that there's some problem with master connectivity and stops all evictions until some connectivity is restored. -Starting in Kubernetes 1.6, the NodeController is also responsible for evicting -pods that are running on nodes with `NoExecute` taints, when the pods do not tolerate -the taints. Additionally, as an alpha feature that is disabled by default, the -NodeController is responsible for adding taints corresponding to node problems like -node unreachable or not ready. See [this documentation](/docs/concepts/configuration/taint-and-toleration/) -for details about `NoExecute` taints and the alpha feature. +The node controller is also responsible for evicting pods running on nodes with +`NoExecute` taints, unless those pods tolerate that taint. +The node controller also adds {{< glossary_tooltip text="taints" term_id="taint" >}} +corresponding to node problems like node unreachable or not ready. This means +that the scheduler won't place Pods onto unhealthy nodes. -Starting in version 1.8, the node controller can be made responsible for creating taints that represent -Node conditions. This is an alpha feature of version 1.8. - -### Self-Registration of Nodes - -When the kubelet flag `--register-node` is true (the default), the kubelet will attempt to -register itself with the API server. This is the preferred pattern, used by most distros. - -For self-registration, the kubelet is started with the following options: - - - `--kubeconfig` - Path to credentials to authenticate itself to the apiserver. - - `--cloud-provider` - How to talk to a cloud provider to read metadata about itself. - - `--register-node` - Automatically register with the API server. - - `--register-with-taints` - Register the node with the given list of taints (comma separated `=:`). No-op if `register-node` is false. - - `--node-ip` - IP address of the node. - - `--node-labels` - Labels to add when registering the node in the cluster (see label restrictions enforced by the [NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction) in 1.13+). - - `--node-status-update-frequency` - Specifies how often kubelet posts node status to master. - -When the [Node authorization mode](/docs/reference/access-authn-authz/node/) and -[NodeRestriction admission plugin](/docs/reference/access-authn-authz/admission-controllers/#noderestriction) are enabled, -kubelets are only authorized to create/modify their own Node resource. - -#### Manual Node Administration - -A cluster administrator can create and modify node objects. - -If the administrator wishes to create node objects manually, set the kubelet flag -`--register-node=false`. - -The administrator can modify node resources (regardless of the setting of `--register-node`). -Modifications include setting labels on the node and marking it unschedulable. - -Labels on nodes can be used in conjunction with node selectors on pods to control scheduling, -e.g. to constrain a pod to only be eligible to run on a subset of the nodes. - -Marking a node as unschedulable prevents new pods from being scheduled to that -node, but does not affect any existing pods on the node. This is useful as a -preparatory step before a node reboot, etc. For example, to mark a node -unschedulable, run this command: - -```shell -kubectl cordon $NODENAME -``` - -{{< note >}} -Pods created by a DaemonSet controller bypass the Kubernetes scheduler -and do not respect the unschedulable attribute on a node. This assumes that daemons belong on -the machine even if it is being drained of applications while it prepares for a reboot. -{{< /note >}} {{< caution >}} `kubectl cordon` marks a node as 'unschedulable', which has the side effect of the service @@ -285,34 +304,40 @@ eligible for, effectively removing incoming load balancer traffic from the cordo ### Node capacity -The capacity of the node (number of cpus and amount of memory) is part of the node object. -Normally, nodes register themselves and report their capacity when creating the node object. If -you are doing [manual node administration](#manual-node-administration), then you need to set node -capacity when adding a node. +Node objects track information about the Node's resource capacity (for example: the amount +of memory available, and the number of CPUs). +Nodes that [self register](#self-registration-of-nodes) report their capacity during +registration. If you [manually](#manual-node-administration) add a Node, then +you need to set the node's capacity informaton when you add it. -The Kubernetes scheduler ensures that there are enough resources for all the pods on a node. It -checks that the sum of the requests of containers on the node is no greater than the node capacity. It -includes all containers started by the kubelet, but not containers started directly by the [container runtime](/docs/concepts/overview/components/#container-runtime) nor any process running outside of the containers. +The Kubernetes {{< glossary_tooltip text="scheduler" term_id="kube-scheduler" >}} ensures that +there are enough resources for all the Pods on a Node. The scheduler checks that the sum +of the requests of containers on the node is no greater than the node's capacity. +That sum of requests includes all containers managed by the kubelet, but excludes any +containers started directly by the container runtime, and also excludes any +processes running outside of the kubelet's control. -If you want to explicitly reserve resources for non-Pod processes, follow this tutorial to +{{< note >}} +If you want to explicitly reserve resources for non-Pod processes, see [reserve resources for system daemons](/docs/tasks/administer-cluster/reserve-compute-resources/#system-reserved). +{{< /note >}} ## Node topology -{{< feature-state state="alpha" >}} +{{< feature-state state="alpha" for_k8s_version="v1.16" >}} If you have enabled the `TopologyManager` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/), then the kubelet can use topology hints when making resource assignment decisions. - -## API Object - -Node is a top-level resource in the Kubernetes REST API. More details about the -API object can be found at: -[Node API object](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#node-v1-core). +See [Control Topology Management Policies on a Node](/docs/tasks/administer-cluster/topology-manager/) +for more information. {{% /capture %}} {{% capture whatsnext %}} -* Read about [node components](/docs/concepts/overview/components/#node-components) -* Read about node-level topology: [Control Topology Management Policies on a node](/docs/tasks/administer-cluster/topology-manager/) +* Learn about the [components](/docs/concepts/overview/components/#node-components) that make up a node. +* Read the [API definition for Node](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#node-v1-core). +* Read the [Node](https://git.k8s.io/community/contributors/design-proposals/architecture/architecture.md#the-kubernetes-node) + section of the architecture design document. +* Read about [taints and tolerations](/docs/concepts/configuration/taint-and-toleration/). +* Read about [cluster autoscaling](/docs/tasks/administer-cluster/cluster-management/#cluster-autoscaling). {{% /capture %}} diff --git a/content/en/docs/concepts/configuration/taint-and-toleration.md b/content/en/docs/concepts/configuration/taint-and-toleration.md index f2a0befec8..95f78aa4fd 100644 --- a/content/en/docs/concepts/configuration/taint-and-toleration.md +++ b/content/en/docs/concepts/configuration/taint-and-toleration.md @@ -10,16 +10,17 @@ weight: 40 {{% capture overview %}} -Node affinity, described [here](/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity), -is a property of *pods* that *attracts* them to a set of nodes (either as a -preference or a hard requirement). Taints are the opposite -- they allow a -*node* to *repel* a set of pods. +[_Node affinity_](/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity), +is a property of {{< glossary_tooltip text="Pods" term_id="pod" >}} that *attracts* them to +a set of {{< glossary_tooltip text="nodes" term_id="node" >}} (either as a preference or a +hard requirement). _Taints_ are the opposite -- they allow a node to repel a set of pods. + +_Tolerations_ are applied to pods, and allow (but do not require) the pods to schedule +onto nodes with matching taints. Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes. One or more taints are applied to a node; this marks that the node should not accept any pods that do not tolerate the taints. -Tolerations are applied to pods, and allow (but do not require) the pods to schedule -onto nodes with matching taints. {{% /capture %}} @@ -65,12 +66,12 @@ Here’s an example of a pod that uses tolerations: {{< codenew file="pods/pod-with-toleration.yaml" >}} +The default value for `operator` is `Equal`. + A toleration "matches" a taint if the keys are the same and the effects are the same, and: * the `operator` is `Exists` (in which case no `value` should be specified), or -* the `operator` is `Equal` and the `value`s are equal - -`Operator` defaults to `Equal` if not specified. +* the `operator` is `Equal` and the `value`s are equal. {{< note >}} @@ -204,7 +205,7 @@ when there are node problems, which is described in the next section. {{< feature-state for_k8s_version="v1.18" state="stable" >}} -Earlier we mentioned the `NoExecute` taint effect, which affects pods that are already +The `NoExecute` taint effect, mentioned above, affects pods that are already running on the node as follows * pods that do not tolerate the taint are evicted immediately @@ -213,9 +214,8 @@ running on the node as follows * pods that tolerate the taint with a specified `tolerationSeconds` remain bound for the specified amount of time -In addition, Kubernetes 1.6 introduced alpha support for representing node -problems. In other words, the node controller automatically taints a node when -certain condition is true. The following taints are built in: +The node controller automatically taints a Node when certain conditions +are true. The following taints are built in: * `node.kubernetes.io/not-ready`: Node is not ready. This corresponds to the NodeCondition `Ready` being "`False`". @@ -236,19 +236,18 @@ with `NoExecute` effect. If the fault condition returns to normal the kubelet or controller can remove the relevant taint(s). {{< note >}} -To maintain the existing [rate limiting](/docs/concepts/architecture/nodes/) -behavior of pod evictions due to node problems, the system actually adds the taints -in a rate-limited way. This prevents massive pod evictions in scenarios such -as the master becoming partitioned from the nodes. +The control plane limits the rate of adding node new taints to nodes. This rate limiting +manages the number of evictions that are triggered when many nodes become unreachable at +once (for example: if there is a network disruption). {{< /note >}} -The feature, in combination with `tolerationSeconds`, allows a pod -to specify how long it should stay bound to a node that has one or both of these problems. +You can specify `tolerationSeconds` for a Pod to define how long that Pod stays bound +to a failing or unresponsive Node. -For example, an application with a lot of local state might want to stay -bound to node for a long time in the event of network partition, in the hope +For example, you might want to keep an application with a lot of local state +bound to node for a long time in the event of network partition, hoping that the partition will recover and thus the pod eviction can be avoided. -The toleration the pod would use in that case would look like +The toleration you set for that Pod might look like: ```yaml tolerations: @@ -258,20 +257,15 @@ tolerations: tolerationSeconds: 6000 ``` -Note that Kubernetes automatically adds a toleration for -`node.kubernetes.io/not-ready` with `tolerationSeconds=300` -unless the pod configuration provided -by the user already has a toleration for `node.kubernetes.io/not-ready`. -Likewise it adds a toleration for -`node.kubernetes.io/unreachable` with `tolerationSeconds=300` -unless the pod configuration provided -by the user already has a toleration for `node.kubernetes.io/unreachable`. +{{< note >}} +Kubernetes automatically adds a toleration for +`node.kubernetes.io/not-ready` and `node.kubernetes.io/unreachable` +with `tolerationSeconds=300`, +unless you, or a controller, set those tolerations explictly. -These automatically-added tolerations ensure that -the default pod behavior of remaining bound for 5 minutes after one of these -problems is detected is maintained. -The two default tolerations are added by the [DefaultTolerationSeconds -admission controller](https://git.k8s.io/kubernetes/plugin/pkg/admission/defaulttolerationseconds). +These automatically-added tolerations mean that Pods remain bound to +Nodes for 5 minutes after one of these problems is detected. +{{< /note >}} [DaemonSet](/docs/concepts/workloads/controllers/daemonset/) pods are created with `NoExecute` tolerations for the following taints with no `tolerationSeconds`: @@ -287,9 +281,8 @@ The node lifecycle controller automatically creates taints corresponding to Node conditions with `NoSchedule` effect. Similarly the scheduler does not check Node conditions; instead the scheduler checks taints. This assures that Node conditions don't affect what's scheduled onto the Node. The user can choose to ignore some of the Node's problems (represented as Node conditions) by adding appropriate Pod tolerations. -Starting in Kubernetes 1.8, the DaemonSet controller automatically adds the -following `NoSchedule` tolerations to all daemons, to prevent DaemonSets from -breaking. +The DaemonSet controller automatically adds the following `NoSchedule` +tolerations to all daemons, to prevent DaemonSets from breaking. * `node.kubernetes.io/memory-pressure` * `node.kubernetes.io/disk-pressure` @@ -299,3 +292,10 @@ breaking. Adding these tolerations ensures backward compatibility. You can also add arbitrary tolerations to DaemonSets. + +{{% /capture %}} +{{% capture whatsnext %}} +* Read about [out of resource handling](/docs/tasks/administer-cluster/out-of-resource/) and how you can configure it +* Read about [pod priority](/docs/concepts/configuration/pod-priority-preemption/) + +{{% /capture %}} diff --git a/content/en/docs/concepts/overview/components.md b/content/en/docs/concepts/overview/components.md index d1d4a1e7fb..e8b5819a38 100644 --- a/content/en/docs/concepts/overview/components.md +++ b/content/en/docs/concepts/overview/components.md @@ -83,7 +83,7 @@ Node components run on every node, maintaining running pods and providing the Ku {{< glossary_definition term_id="kube-proxy" length="all" >}} -### Container Runtime +### Container runtime {{< glossary_definition term_id="container-runtime" length="all" >}} diff --git a/content/en/docs/reference/glossary/node.md b/content/en/docs/reference/glossary/node.md index a67ecf488d..fd09ec75b4 100755 --- a/content/en/docs/reference/glossary/node.md +++ b/content/en/docs/reference/glossary/node.md @@ -15,3 +15,5 @@ tags: A worker node may be a VM or physical machine, depending on the cluster. It has local daemons or services necessary to run {{< glossary_tooltip text="Pods" term_id="pod" >}} and is managed by the control plane. The daemons on a node include {{< glossary_tooltip text="kubelet" term_id="kubelet" >}}, {{< glossary_tooltip text="kube-proxy" term_id="kube-proxy" >}}, and a container runtime implementing the {{< glossary_tooltip text="CRI" term_id="cri" >}} such as {{< glossary_tooltip term_id="docker" >}}. + +In early Kubernetes versions, Nodes were called “Minions”. From 2c9a9a64ecebe396bae3807fa5a7c4327455d6c1 Mon Sep 17 00:00:00 2001 From: Davi Garcia Date: Tue, 28 Apr 2020 14:16:01 -0300 Subject: [PATCH 10/67] Clarify minimum cluster resource requirement for tasks Signed-off-by: Davi Garcia --- .../manage-resources/cpu-constraint-namespace.md | 8 ++------ .../tasks/configure-pod-container/assign-cpu-resource.md | 6 ++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/content/en/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace.md b/content/en/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace.md index 2098a42991..a1d4c786c6 100644 --- a/content/en/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace.md +++ b/content/en/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace.md @@ -20,7 +20,7 @@ in the namespace. {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} -Each node in your cluster must have at least 1 CPU. +Your cluster must have at least 1 CPU available for use to run the task examples. {{% /capture %}} @@ -204,11 +204,7 @@ Because your Container did not specify its own CPU request and limit, it was giv [default CPU request and limit](/docs/tasks/administer-cluster/cpu-default-namespace/) from the LimitRange. -At this point, your Container might be running or it might not be running. Recall that a prerequisite -for this task is that your Nodes have at least 1 CPU. If each of your Nodes has only -1 CPU, then there might not be enough allocatable CPU on any Node to accommodate a request -of 800 millicpu. If you happen to be using Nodes with 2 CPU, then you probably have -enough CPU to accommodate the 800 millicpu request. +At this point, your Container might be running or it might not be running. Recall that a prerequisite for this task is that your cluster must have at least 1 CPU available for use. If each of your Nodes has only 1 CPU, then there might not be enough allocatable CPU on any Node to accommodate a request of 800 millicpu. If you happen to be using Nodes with 2 CPU, then you probably have enough CPU to accommodate the 800 millicpu request. Delete your Pod: diff --git a/content/en/docs/tasks/configure-pod-container/assign-cpu-resource.md b/content/en/docs/tasks/configure-pod-container/assign-cpu-resource.md index c5ec448e48..a622eb5917 100644 --- a/content/en/docs/tasks/configure-pod-container/assign-cpu-resource.md +++ b/content/en/docs/tasks/configure-pod-container/assign-cpu-resource.md @@ -18,7 +18,7 @@ allocated as much CPU as it requests. {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} -Each node in your cluster must have at least 1 CPU. +Your cluster must have at least 1 CPU available for use to run the task examples. A few of the steps on this page require you to run the [metrics-server](https://github.com/kubernetes-incubator/metrics-server) @@ -122,9 +122,7 @@ Recall that by setting `-cpu "2"`, you configured the Container to attempt to us {{< note >}} Another possible explanation for the CPU use being below 1.0 is that the Node might not have -enough CPU resources available. Recall that the prerequisites for this exercise require each of -your Nodes to have at least 1 CPU. If your Container runs on a Node that has only 1 CPU, the Container -cannot use more than 1 CPU regardless of the CPU limit specified for the Container. +enough CPU resources available. Recall that the prerequisites for this exercise require your cluster to have at least 1 CPU available for use. If your Container runs on a Node that has only 1 CPU, the Container cannot use more than 1 CPU regardless of the CPU limit specified for the Container. {{< /note >}} ## CPU units From ee5373d516fdef30d3bd124312d58b52c89827aa Mon Sep 17 00:00:00 2001 From: bryan Date: Thu, 30 Apr 2020 09:46:05 +0800 Subject: [PATCH 11/67] translate configmap into chinese --- .../docs/concepts/configuration/configmap.md | 230 ++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 content/zh/docs/concepts/configuration/configmap.md diff --git a/content/zh/docs/concepts/configuration/configmap.md b/content/zh/docs/concepts/configuration/configmap.md new file mode 100644 index 0000000000..0dfcf6ce03 --- /dev/null +++ b/content/zh/docs/concepts/configuration/configmap.md @@ -0,0 +1,230 @@ +--- +title: ConfigMaps +content_template: templates/concept +weight: 20 +--- + +{{% capture overview %}} + +{{< glossary_definition term_id="configmap" prepend="A ConfigMap is" length="all" >}} + +{{< caution >}} + +ConfigMap 并不提供保密或者加密功能。如果你想存储的数据是机密的,请使用 {{< glossary_tooltip text="Secret" term_id="secret" >}} ,或者使用其他第三方工具来保证你的数据的私密性,而不是用 ConfigMap。 +{{< /caution >}} + +{{% /capture %}} + +{{% capture body %}} + + +## 动机 + +使用 ConfigMap 来将你的配置数据和应用程序代码分开。 + +比如,假设你正在开发一个应用,它可以在你自己的电脑上(用于开发)和在云上(用于实际流量)运行。你的代码里有一段是用于查看环境变量 `DATABASE_HOST`,在本地运行时,你将这个变量设置为 `localhost`,在云上,你将其设置为引用 Kubernetes 集群中的公开数据库 {{< glossary_tooltip text="Service" term_id="service" >}} 中的组件。 + +这让您可以获取在云中运行的容器镜像,并且如果有需要的话,在本地调试完全相同的代码。 + + +## ConfigMap 对象 + +ConfigMap 是一个 API [对象](/docs/concepts/overview/working-with-objects/kubernetes-objects/),让你可以存储其他对象所需要使用的配置。和其他 Kubernetes 对象都有一个 `spec` 不同的是,ConfigMap 使用 `data` 块来存储一个键和它的值。 + +ConfigMap 的名字必须是一个合法的 [DNS 子域名](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)。 + + +## ConfigMaps 和 Pods + +您可以写一个引用 ConfigMap 的 Pod 的 `spec`,并根据 ConfigMap 中的数据在该 Pod 中配置容器。这个 Pod 和 ConfigMap 必须要在同一个 {{< glossary_tooltip text="namespace" term_id="namespace" >}} 中。 + +这是一个 ConfigMap 的示例,它的一些键只有一个值,其他键的值看起来像是配置的片段格式。 + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + Name: game-demo +data: + # property-like keys; each key maps to a simple value + player_initial_lives: 3 + ui_properties_file_name: "user-interface.properties" + # + # file-like keys + game.properties: | + enemy.types=aliens,monsters + player.maximum-lives=5 + user-interface.properties: | + color.good=purple + color.bad=yellow + allow.textmode=true +``` + +您可以使用四种方式来使用 ConfigMap 在 Pod 内配置一个容器: + +1. 容器入口点的命令行参数 +1. 容器的环境变量 +1. 在只读卷里面添加一个文件,让应用来读取 +1. 编写代码在能够使用 Kubernetes API 来读取 ConfigMap 的 Pod 中运行 + +这些不同的方法适用于不同的方式来对数据进行建模。对前三个方法,{{< glossary_tooltip text="kubelet" term_id="kubelet" >}} 使用 Secret 中的数据在 Pod 中启动容器。 + + +第四种方法意味着你必须编写代码才能读取 Secret 和它的数据。然而,由于您是直接使用 Kubernetes API,因此只要 ConfigMap 发生更改,您的应用就能够通过订阅来获取更新,并且在这样的情况发生的时候做出反应。通过直接进入 Kubernetes API,这个技术也可以让你能够获取到不同的命名空间里的 ConfigMap。 + +这是一个 Pod 的示例,它通过使用 `game-demo` 中的值来配置一个 Pod: + +```yaml +apiVersion: v1 +kind: Pod +metadata: + name: configmap-demo-pod +spec: + containers: + - name: demo + image: game.example/demo-game + env: + # Define the environment variable + - name: PLAYER_INITIAL_LIVES # Notice that the case is different here + # from the key name in the ConfigMap. + valueFrom: + configMapKeyRef: + name: game-demo # The ConfigMap this value comes from. + key: player_initial_lives # The key to fetch. + - name: UI_PROPERTIES_FILE_NAME + valueFrom: + configMapKeyRef: + name: game-demo + key: ui_properties_file_name + volumeMounts: + - name: config + mountPath: "/config" + readOnly: true + volumes: + # You set volumes at the Pod level, then mount them into containers inside that Pod + - name: config + configMap: + # Provide the name of the ConfigMap you want to mount. + name: game-demo +``` + + +ConfigMap 不会区分单行属性值和多行类似文件的值,重要的是 Pods 和其他对象如何使用这些值。比如,定义一个卷,并将它作为 `/config` 文件夹安装到 `demo` 容器内,并创建四个文件: + +- `/config/player_initial_lives` +- `/config/ui_properties_file_name` +- `/config/game.properties` +- `/config/user-interface.properties` + +如果您要确保 `/config` 只包含带有 `.properties` 扩展名的文件,可以使用两个不同的 ConfigMaps,并在 `spec` 中同时引用这两个 ConfigMaps 来创建 Pod。第一个 ConfigMap 定义了 `player_initial_lives` 和 `ui_properties_file_name`,第二个 ConfigMap 定义了 kubelet 放进 `/config` 的文件。 + +{{< note >}} + +ConfigMaps 最常见的用法是为同一命名空间里的 Pod 中运行的容器配置设置。您也可以单独使用 ConfigMap。 + +比如,您可能会遇到基于 ConfigMap 来调整其行为的 {{< glossary_tooltip text="addons" term_id="addons" >}} 或者 {{< glossary_tooltip text="operators" term_id="operator-pattern" >}}。 +{{< /note >}} + + +{{% /capture %}} +{{% capture whatsnext %}} + + +* 阅读 [Secrets](/docs/concepts/configuration/secret/)。 +* 阅读 [配置 Pod 来使用 ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/)。 +* 阅读 [Twelve-Factor 应用](https://12factor.net/) 来了解将代码和配置分开的动机。 + +{{% /capture %}} From 6c5ddc2ce6fa51171bed82dd4ac3a9a857f33923 Mon Sep 17 00:00:00 2001 From: bryan Date: Thu, 30 Apr 2020 10:29:11 +0800 Subject: [PATCH 12/67] fix some translation errors fix some translation errors --- .../docs/concepts/configuration/configmap.md | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/content/zh/docs/concepts/configuration/configmap.md b/content/zh/docs/concepts/configuration/configmap.md index 0dfcf6ce03..26afa91d29 100644 --- a/content/zh/docs/concepts/configuration/configmap.md +++ b/content/zh/docs/concepts/configuration/configmap.md @@ -59,7 +59,7 @@ The name of a ConfigMap must be a valid --> ## ConfigMap 对象 -ConfigMap 是一个 API [对象](/docs/concepts/overview/working-with-objects/kubernetes-objects/),让你可以存储其他对象所需要使用的配置。和其他 Kubernetes 对象都有一个 `spec` 不同的是,ConfigMap 使用 `data` 块来存储一个键和它的值。 +ConfigMap 是一个 API [对象](/docs/concepts/overview/working-with-objects/kubernetes-objects/),让你可以存储其他对象所需要使用的配置。和其他 Kubernetes 对象都有一个 `spec` 不同的是,ConfigMap 使用 `data` 块来存储元素(键名)和它们的值。 ConfigMap 的名字必须是一个合法的 [DNS 子域名](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)。 @@ -76,7 +76,7 @@ format. --> ## ConfigMaps 和 Pods -您可以写一个引用 ConfigMap 的 Pod 的 `spec`,并根据 ConfigMap 中的数据在该 Pod 中配置容器。这个 Pod 和 ConfigMap 必须要在同一个 {{< glossary_tooltip text="namespace" term_id="namespace" >}} 中。 +您可以写一个引用 ConfigMap 的 Pod 的 `spec`,并根据 ConfigMap 中的数据在该 Pod 中配置容器。这个 Pod 和 ConfigMap 必须要在同一个 {{< glossary_tooltip text="命名空间" term_id="namespace" >}} 中。 这是一个 ConfigMap 的示例,它的一些键只有一个值,其他键的值看起来像是配置的片段格式。 @@ -114,14 +114,14 @@ For the first three methods, the {{< glossary_tooltip text="kubelet" term_id="kubelet" >}} uses the data from the Secret when it launches container(s) for a Pod. --> -您可以使用四种方式来使用 ConfigMap 在 Pod 内配置一个容器: +您可以使用四种方式来使用 ConfigMap 配置 Pod 中的容器: -1. 容器入口点的命令行参数 +1. 容器 entrypoint 的命令行参数 1. 容器的环境变量 1. 在只读卷里面添加一个文件,让应用来读取 -1. 编写代码在能够使用 Kubernetes API 来读取 ConfigMap 的 Pod 中运行 +1. 编写代码在 Pod 中运行,使用 Kubernetes API 来读取 ConfigMap -这些不同的方法适用于不同的方式来对数据进行建模。对前三个方法,{{< glossary_tooltip text="kubelet" term_id="kubelet" >}} 使用 Secret 中的数据在 Pod 中启动容器。 +这些不同的方法适用于不同的数据使用方式。对前三个方法,{{< glossary_tooltip text="kubelet" term_id="kubelet" >}} 使用 Secret 中的数据在 Pod 中启动容器。 -ConfigMaps 最常见的用法是为同一命名空间里的 Pod 中运行的容器配置设置。您也可以单独使用 ConfigMap。 +ConfigMaps 最常见的用法是为同一命名空间里某 Pod 中运行的容器执行配置。您也可以单独使用 ConfigMap。 比如,您可能会遇到基于 ConfigMap 来调整其行为的 {{< glossary_tooltip text="addons" term_id="addons" >}} 或者 {{< glossary_tooltip text="operators" term_id="operator-pattern" >}}。 {{< /note >}} From 53884a0c89d719f2fad9a7f51124194d6cba70d0 Mon Sep 17 00:00:00 2001 From: Dominic Yin Date: Fri, 1 May 2020 17:18:39 +0800 Subject: [PATCH 13/67] Update content/zh/docs/concepts/services-networking/network-policies.md --- .../services-networking/network-policies.md | 201 ++++++++---------- 1 file changed, 90 insertions(+), 111 deletions(-) diff --git a/content/zh/docs/concepts/services-networking/network-policies.md b/content/zh/docs/concepts/services-networking/network-policies.md index 76aea85e3a..fa38f36fd7 100644 --- a/content/zh/docs/concepts/services-networking/network-policies.md +++ b/content/zh/docs/concepts/services-networking/network-policies.md @@ -4,19 +4,31 @@ content_template: templates/concept weight: 50 --- + + {{< toc >}} {{% capture overview %}} -网络策略(NetworkPolicy)是一种关于pod间及pod与其他网络端点间所允许的通信规则的规范。 +网络策略(NetworkPolicy)是一种关于 {{< glossary_tooltip text="Pod" term_id="pod">}} 间及与其他网络端点间所允许的通信规则的规范。 -`NetworkPolicy` 资源使用标签选择pod,并定义选定pod所允许的通信规则。 +NetworkPolicy 资源使用 {{< glossary_tooltip text="标签" term_id="label">}} 选择 Pod,并定义选定 Pod 所允许的通信规则。 {{% /capture %}} @@ -25,12 +37,12 @@ A network policy is a specification of how groups of pods are allowed to communi ## 前提 -网络策略通过网络插件来实现,所以用户必须使用支持 `NetworkPolicy` 的网络解决方案 - 简单地创建资源对象,而没有控制器来使它生效的话,是没有任何作用的。 +网络策略通过[网络插件](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/)来实现。要使用网络策略,用户必须使用支持 NetworkPolicy 的网络解决方案。创建一个资源对象,而没有控制器来使它生效的话,是没有任何作用的。 -## 隔离和非隔离的Pod +## 隔离和非隔离的 Pod -默认情况下,Pod是非隔离的,它们接受任何来源的流量。 +默认情况下,Pod 是非隔离的,它们接受任何来源的流量。 -Pod可以通过相关的网络策略进行隔离。一旦命名空间中有网络策略选择了特定的Pod,该Pod会拒绝网络策略所不允许的连接。 (命名空间下其他未被网络策略所选择的Pod会继续接收所有的流量) +Pod 可以通过相关的网络策略进行隔离。一旦命名空间中有网络策略选择了特定的 Pod,该 Pod 会拒绝网络策略所不允许的连接。 (命名空间下其他未被网络策略所选择的 Pod 会继续接收所有的流量) + +网络策略不会冲突,它们是附加的。如果任何一个或多个策略选择了一个 Pod, 则该 Pod 受限于这些策略的 ingress/egress 规则的并集。因此评估的顺序并不会影响策略的结果。 -## `NetworkPolicy` 资源 +## NetworkPolicy 资源 {#networkpolicy-resource} -查看 [网络策略](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#networkpolicy-v1-networking-k8s-io) 来了解资源定义。 +查看 [网络策略](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#networkpolicy-v1-networking-k8s-io) 来了解完整的资源定义。 -下面是一个 `NetworkPolicy` 的示例: +下面是一个 NetworkPolicy 的示例: ```yaml apiVersion: networking.k8s.io/v1 @@ -97,39 +113,43 @@ spec: port: 5978 ``` - +{{< note >}} +除非选择支持网络策略的网络解决方案,否则将上述示例发送到API服务器没有任何效果。 +{{< /note >}} -__Mandatory Fields__: As with all other Kubernetes config, a `NetworkPolicy` + -除非选择支持网络策略的网络解决方案,否则将上述示例发送到API服务器没有任何效果。 +__必填字段__: 与所有其他的 Kubernetes 配置一样,NetworkPolicy 需要 `apiVersion`、 `kind` 和 `metadata` 字段。 关于配置文件操作的一般信息,请参考 [使用 ConfigMap 配置容器](/docs/tasks/configure-pod-container/configure-pod-configmap/), +和 [对象管理](/docs/concepts/overview/working-with-objects/object-management)。 -__必填字段__: 与所有其他的Kubernetes配置一样,`NetworkPolicy` 需要 `apiVersion`、 `kind`和 `metadata` 字段。 关于配置文件操作的一般信息,请参考 [这里](/docs/user-guide/simple-yaml)、 [这里](/docs/user-guide/configuring-containers)和 [这里](/docs/user-guide/working-with-resources)。 +__spec__: NetworkPolicy [规约](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status) 中包含了在一个命名空间中定义特定网络策略所需的所有信息。 -__spec__: `NetworkPolicy` [spec](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status) 中包含了在一个命名空间中定义特定网络策略所需的所有信息 +__podSelector__: 每个 NetworkPolicy 都包括一个 `podSelector` ,它对该策略所应用的一组 Pod 进行选择。示例中的策略选择带有 "role=db" 标签的 Pod。空的 `podSelector` 选择命名空间下的所有 Pod。 -__podSelector__: 每个 `NetworkPolicy` 都包括一个 `podSelector` ,它对该策略所应用的一组Pod进行选择。因为 `NetworkPolicy` 目前只支持定义 `ingress` 规则,这里的 `podSelector` 本质上是为该策略定义 "目标pod" 。示例中的策略选择带有 "role=db" 标签的pod。空的 `podSelector` 选择命名空间下的所有pod。 +__policyTypes__: 每个 NetworkPolicy 都包含一个 `policyTypes` 列表,其中包含 `Ingress` 或 `Egress` 或两者兼具。`policyTypes` 字段表示给定的策略是否应用于进入所选 Pod 的入口流量或者来自所选 Pod 的出口流量,或两者兼有。如果 NetworkPolicy 未指定 `policyTypes` 则默认情况下始终设置 `Ingress`,如果 NetworkPolicy 有任何出口规则的话则设置 `Egress`。 -__policyTypes__: Each `NetworkPolicy` includes a `policyTypes` list which may include either `Ingress`, `Egress`, or both. The `policyTypes` field indicates whether or not the given policy applies to ingress traffic to selected pod, egress traffic from selected pods, or both. If no `policyTypes` are specified on a NetworkPolicy then by default `Ingress` will always be set and `Egress` will be set if the NetworkPolicy has any egress rules. +__ingress__: 每个 NetworkPolicy 可包含一个 `ingress` 规则的白名单列表。每个规则都允许同时匹配 `from` 和 `ports` 部分的流量。示例策略中包含一条简单的规则: 它匹配一个单一的端口,来自三个来源中的一个, 第一个通过 `ipBlock` 指定,第二个通过 `namespaceSelector` 指定,第三个通过 `podSelector` 指定。 -__ingress__: 每个 `NetworkPolicy` 包含一个 `ingress` 规则的白名单列表。(其中的)规则允许同时匹配 `from` 和 `ports` 部分的流量。示例策略中包含一条简单的规则: 它匹配一个单一的端口,来自两个来源中的一个, 第一个通过 `namespaceSelector` 指定,第二个通过 `podSelector` 指定。 - -__egress__: 每个 `NetworkPolicy` 包含一个 `egress` 规则的白名单列表。每个规则都允许匹配 `to` 和 `port` 部分的流量。该示例策略包含一条规则,该规则将单个端口上的流量匹配到 `10.0.0.0/24` 中的任何目的地。 +__egress__: 每个 NetworkPolicy 可包含一个 `egress` 规则的白名单列表。每个规则都允许匹配 `to` 和 `port` 部分的流量。该示例策略包含一条规则,该规则将单个端口上的流量匹配到 `10.0.0.0/24` 中的任何目的地。 -所以,示例网络策略: +所以,该网络策略示例: -1. 隔离 "default" 命名空间下 "role=db" 的pod (如果它们不是已经被隔离的话)。 -2. 允许从 "default" 命名空间下带有 "role=frontend" 标签的pod到 "default" 命名空间下的pod的6379 TCP端口的连接。 +1. 隔离 "default" 命名空间下 "role=db" 的 Pod (如果它们不是已经被隔离的话)。 +2. (Ingress 规则)允许以下 Pod 连接到 "default" 命名空间下的带有 “role=db” 标签的所有 Pod 的 6379 TCP 端口: - * 标签为 "role=frontend" 的 "default" 名称空间中的任何Pod - * 名称空间中带有标签 "project=myproject" 的任何pod + * "default" 命名空间下任意带有 "role=frontend" 标签的 Pod + * 带有 "project=myproject" 标签的任意命名空间中的 Pod * IP 地址范围为 172.17.0.0–172.17.0.255 和 172.17.2.0–172.17.255.255(即,除了 172.17.1.0/24 之外的所有 172.17.0.0/16) -3. 允许从带有 "project=myproject" 标签的命名空间下的任何 pod 到 "default" 命名空间下的 pod 的6379 TCP端口的连接。 +3. (Egress 规则)允许从带有 "role=db" 标签的命名空间下的任何 Pod 到 CIDR 10.0.0.0/24 下 5978 TCP 端口的连接。 -查看 [网络策略入门指南](/docs/getting-started-guides/network-policy/walkthrough) 了解更多示例。 +查看 [声明网络策略](/docs/getting-started-guides/network-policy/walkthrough) 来进行更多的示例演练。 +在 `from` 数组中仅包含一个元素,只允许来自标有 `role=client` 的 Pod 且该 Pod 所在的命名空间中标有 `user=alice` 的连接。但是 *这项* 策略: ```yaml ... @@ -227,7 +250,7 @@ For egress, this means that connections from pods to `Service` IPs that get rewr cluster-external IPs may or may not be subject to `ipBlock`-based policies. --> -在 `from` 数组中包含两个元素,允许来自本地命名空间中标有 `role = client` 的 Pod 的连接,*或*来自任何名称空间中标有`user = alice`的任何Pod的连接。 +在 `from` 数组中包含两个元素,允许来自本地命名空间中标有 `role=client` 的 Pod 的连接,*或* 来自任何命名空间中标有 `user = alice` 的任何 Pod 的连接。 如有疑问,请使用 `kubectl describe` 查看 Kubernetes 如何解释该策略。 @@ -235,7 +258,7 @@ __ipBlock__: 这将选择特定的 IP CIDR 范围以用作入口源或出口目 群集的入口和出口机制通常需要重写数据包的源 IP 或目标 IP。在发生这种情况的情况下,不确定在 NetworkPolicy 处理之前还是之后发生,并且对于网络插件,云提供商,`Service` 实现等的不同组合,其行为可能会有所不同。 -在进入的情况下,这意味着在某些情况下,您可以根据实际的原始源 IP 过滤传入的数据包,而在其他情况下,NetworkPolicy 所作用的 `源IP` 则可能是 `LoadBalancer` 或 Pod的节点等。 +在进入的情况下,这意味着在某些情况下,您可以根据实际的原始源 IP 过滤传入的数据包,而在其他情况下,NetworkPolicy 所作用的 `源IP` 则可能是 `LoadBalancer` 或 Pod 的节点等。 对于出口,这意味着从 Pod 到被重写为集群外部 IP 的 `Service` IP 的连接可能会或可能不会受到基于 `ipBlock` 的策略的约束。 @@ -248,7 +271,7 @@ in that namespace. ## 默认策略 -默认情况下,如果名称空间中不存在任何策略,则所有进出该名称空间中的Pod的流量都被允许。以下示例使您可以更改该名称空间中的默认行为。 +默认情况下,如果命名空间中不存在任何策略,则所有进出该命名空间中的 Pod 的流量都被允许。以下示例使您可以更改该命名空间中的默认行为。 -Kubernetes 支持 SCTP 作为 NetworkPolicy 定义中的协议值作为 alpha 功能提供。要启用此功能,集群管理员需要在 apiserver 上启用 `SCTPSupport` 功能门,例如 `“--feature-gates=SCTPSupport=true,...”`。启用功能门后,用户可以将 `NetworkPolicy` 的 `protocol` 字段设置为 `SCTP`。 Kubernetes 相应地为 SCTP 关联设置网络,就像为 TCP 连接一样。 +要启用此特性,你(或你的集群管理员)需要通过为 API server 指定 `--feature-gates=SCTPSupport=true,…` 来启用 `SCTPSupport` [特性开关](/docs/reference/command-line-tools-reference/feature-gates/)。启用该特性开关后,用户可以将 NetworkPolicy 的 `protocol` 字段设置为 `SCTP`。 + + +{{< note >}} +必须使用支持 SCTP 协议网络策略的 {{< glossary_tooltip text="CNI" term_id="cni" >}} 插件。 +{{< /note >}} -CNI插件必须在 `NetworkPolicy` 中将 SCTP 作为 `protocol` 值支持。 {{% /capture %}} @@ -401,10 +379,11 @@ CNI插件必须在 `NetworkPolicy` 中将 SCTP 作为 `protocol` 值支持。 - 查看 [声明网络策略](/docs/tasks/administer-cluster/declare-network-policy/) 来进行更多的示例演练 -- 有关NetworkPolicy资源启用的常见方案的更多信息,请参见 [Recipes](https://github.com/ahmetb/kubernetes-network-policy-recipes)。 +- 有关 NetworkPolicy 资源启用的常见场景的更多信息,请参见 [指南](https://github.com/ahmetb/kubernetes-network-policy-recipes)。 + {{% /capture %}} From d13ae7a5da842479af234392d24866a546a53597 Mon Sep 17 00:00:00 2001 From: Antonio Savage Date: Fri, 1 May 2020 21:19:41 -0500 Subject: [PATCH 14/67] Fixed configure-access-multiple-clusters.md I fixed a Powershell command that you had provided in this document. Attempting to run the command with the format you supplied resulted in errors due to some conflict between using backwards slash for pathnames inside of parentheses. --- .../configure-access-multiple-clusters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md b/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md index 4cccac0f58..acd023548a 100644 --- a/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md +++ b/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md @@ -346,7 +346,7 @@ export KUBECONFIG=$KUBECONFIG:$HOME/.kube/config ``` ### Windows Powershell ```shell -$Env:KUBECONFIG=($Env:KUBECONFIG;$HOME/.kube/config) +$Env:KUBECONFIG="$Env:KUBECONFIG;$HOME\.kube\config" ``` View configuration information merged from all the files that are now listed From 7f95a9e4199cadb5f2d777ba591e8d43278c40e2 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Sun, 3 May 2020 14:39:31 +0900 Subject: [PATCH 15/67] Fix a broken table in contribute/new-content/overview.md by modifying shortcodes. --- layouts/shortcodes/latest-version.html | 2 +- layouts/shortcodes/release-branch.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/shortcodes/latest-version.html b/layouts/shortcodes/latest-version.html index ece9e21df7..ba8a6811b2 100644 --- a/layouts/shortcodes/latest-version.html +++ b/layouts/shortcodes/latest-version.html @@ -1 +1 @@ -{{ site.Params.latest }} +{{ site.Params.latest }} \ No newline at end of file diff --git a/layouts/shortcodes/release-branch.html b/layouts/shortcodes/release-branch.html index 7c760ebebf..df21f05b64 100644 --- a/layouts/shortcodes/release-branch.html +++ b/layouts/shortcodes/release-branch.html @@ -1,3 +1,3 @@ {{- $latestVersion := site.Params.latest }} {{- $latestReleaseBranch := printf "release-%s" (replace $latestVersion "v" "") }} -{{- $latestReleaseBranch }} +{{- $latestReleaseBranch }} \ No newline at end of file From 5f18998e7360a73976e2fd1728444ef6b046c7ea Mon Sep 17 00:00:00 2001 From: jqmichael Date: Sun, 3 May 2020 12:02:23 -0700 Subject: [PATCH 16/67] Made autoscale command more explicit --- content/en/docs/concepts/workloads/controllers/replicaset.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/concepts/workloads/controllers/replicaset.md b/content/en/docs/concepts/workloads/controllers/replicaset.md index fe7a96c138..92cbe60a33 100644 --- a/content/en/docs/concepts/workloads/controllers/replicaset.md +++ b/content/en/docs/concepts/workloads/controllers/replicaset.md @@ -330,7 +330,7 @@ Alternatively, you can use the `kubectl autoscale` command to accomplish the sam (and it's easier!) ```shell -kubectl autoscale rs frontend --max=10 +kubectl autoscale rs frontend --max=10 --min=3 --cpu-percent=50 ``` ## Alternatives to ReplicaSet From 8dbb2b19cfa21381f3bbdaa449c148c22997c382 Mon Sep 17 00:00:00 2001 From: Prasad Katti Date: Sun, 3 May 2020 23:46:26 -0700 Subject: [PATCH 17/67] [kubeadm] warn if kernel/docker/etcd version(s) are older than the minimum required version(s) --- .../reference/setup-tools/kubeadm/implementation-details.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/docs/reference/setup-tools/kubeadm/implementation-details.md b/content/en/docs/reference/setup-tools/kubeadm/implementation-details.md index e368a56847..380838b179 100644 --- a/content/en/docs/reference/setup-tools/kubeadm/implementation-details.md +++ b/content/en/docs/reference/setup-tools/kubeadm/implementation-details.md @@ -81,12 +81,12 @@ The user can skip specific preflight checks or all of them with the `--ignore-pr - [warning] If the Kubernetes version to use (specified with the `--kubernetes-version` flag) is at least one minor version higher than the kubeadm CLI version. - Kubernetes system requirements: - if running on linux: - - [error] if not Kernel 3.10+ or 4+ with specific KernelSpec + - [error] if Kernel is older than the minimum required version - [error] if required cgroups subsystem aren't in set up - if using docker: - [warning/error] if Docker service does not exist, if it is disabled, if it is not active. - [error] if Docker endpoint does not exist or does not work - - [warning] if docker version >17.03 + - [warning] if docker version is not in the list of validated docker versions - If using other cri engine: - [error] if crictl socket does not answer - [error] if user is not root @@ -108,7 +108,7 @@ The user can skip specific preflight checks or all of them with the `--ignore-pr - [warning] if connection to services subnet goes through proxy (only first address checked) - [warning] if connection to Pods subnet goes through proxy (only first address checked) - If external etcd is provided: - - [Error] if etcd version less than 3.0.14 + - [Error] if etcd version is older than the minimum required version - [Error] if etcd certificates or keys are specified, but not provided - If external etcd is NOT provided (and thus local etcd will be installed): - [Error] if ports 2379 is used From 63550c9e88f766133965bb51f6300c9f6fe7791f Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Mon, 4 May 2020 17:22:19 +0100 Subject: [PATCH 18/67] Don't mention EndpointSlice resource on front page EndpointSlice is a nice idea, but it's not front-page-of-site nice. Remove it. --- .../en/docs/concepts/services-networking/endpoint-slices.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/content/en/docs/concepts/services-networking/endpoint-slices.md b/content/en/docs/concepts/services-networking/endpoint-slices.md index 7c39f05086..940374ae52 100644 --- a/content/en/docs/concepts/services-networking/endpoint-slices.md +++ b/content/en/docs/concepts/services-networking/endpoint-slices.md @@ -2,11 +2,6 @@ reviewers: - freehan title: EndpointSlices -feature: - title: EndpointSlices - description: > - Scalable tracking of network endpoints in a Kubernetes cluster. - content_template: templates/concept weight: 15 --- From 1c7dcfc6de24b40f36856987761348af1f6b1bf7 Mon Sep 17 00:00:00 2001 From: Bridget Kromhout Date: Mon, 4 May 2020 14:03:31 -0500 Subject: [PATCH 19/67] Clarify IPv4 and IPv6 Signed-off-by: Bridget Kromhout --- .../docs/concepts/services-networking/dual-stack.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/content/en/docs/concepts/services-networking/dual-stack.md b/content/en/docs/concepts/services-networking/dual-stack.md index 3128f2eef4..c753c17cc1 100644 --- a/content/en/docs/concepts/services-networking/dual-stack.md +++ b/content/en/docs/concepts/services-networking/dual-stack.md @@ -49,8 +49,8 @@ To enable IPv4/IPv6 dual-stack, enable the `IPv6DualStack` [feature gate](/docs/ * `--feature-gates="IPv6DualStack=true"` * kube-controller-manager: * `--feature-gates="IPv6DualStack=true"` - * `--cluster-cidr=,` eg. `--cluster-cidr=10.244.0.0/16,fc00::/48` - * `--service-cluster-ip-range=,` eg. `--service-cluster-ip-range=10.0.0.0/16,fd00::/108` + * `--cluster-cidr=,` + * `--service-cluster-ip-range=,` * `--node-cidr-mask-size-ipv4|--node-cidr-mask-size-ipv6` defaults to /24 for IPv4 and /64 for IPv6 * kubelet: * `--feature-gates="IPv6DualStack=true"` @@ -58,6 +58,13 @@ To enable IPv4/IPv6 dual-stack, enable the `IPv6DualStack` [feature gate](/docs/ * `--cluster-cidr=,` * `--feature-gates="IPv6DualStack=true"` +{{< note >}} +An example of an IPv4 CIDR: `10.244.0.0/16` (though you would supply your own address range) + +An example of an IPv6 CIDR: `fdXY:IJKL:MNOP:15::/64` (this shows the format but is not a valid address - see [RFC 4193](https://tools.ietf.org/html/rfc4193)) + +{{< /note >}} + ## Services If your cluster has IPv4/IPv6 dual-stack networking enabled, you can create {{< glossary_tooltip text="Services" term_id="service" >}} with either an IPv4 or an IPv6 address. You can choose the address family for the Service's cluster IP by setting a field, `.spec.ipFamily`, on that Service. From e119d7a90557a9e63cfdd22231ce9273a3492fe9 Mon Sep 17 00:00:00 2001 From: viniciusbds Date: Fri, 17 Apr 2020 20:30:41 -0300 Subject: [PATCH 20/67] Remove the --generator deprecated flag of Horizontal Pod Autoscaler Walkthrough tutorial. --- .../run-application/horizontal-pod-autoscale-walkthrough.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough.md b/content/en/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough.md index 800abfea69..80368f1745 100644 --- a/content/en/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough.md +++ b/content/en/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough.md @@ -115,7 +115,7 @@ Now, we will see how the autoscaler reacts to increased load. We will start a container, and send an infinite loop of queries to the php-apache service (please run it in a different terminal): ```shell -kubectl run --generator=run-pod/v1 -it --rm load-generator --image=busybox /bin/sh +kubectl run -it --rm load-generator --image=busybox /bin/sh Hit enter for command prompt From 20187db4bbcdf6281522b08a6286f101eb99305c Mon Sep 17 00:00:00 2001 From: Prasad Katti Date: Tue, 5 May 2020 00:08:31 -0700 Subject: [PATCH 21/67] Update kubeadm-kubelet integration doc --- .../tools/kubeadm/kubelet-integration.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md b/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md index 641d349440..070dbd7274 100644 --- a/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md +++ b/content/en/docs/setup/production-environment/tools/kubeadm/kubelet-integration.md @@ -15,15 +15,15 @@ The lifecycle of the kubeadm CLI tool is decoupled from the on each node within the Kubernetes cluster. The kubeadm CLI tool is executed by the user when Kubernetes is initialized or upgraded, whereas the kubelet is always running in the background. -Since the kubelet is a daemon, it needs to be maintained by some kind of a init +Since the kubelet is a daemon, it needs to be maintained by some kind of an init system or service manager. When the kubelet is installed using DEBs or RPMs, systemd is configured to manage the kubelet. You can use a different service manager instead, but you need to configure it manually. Some kubelet configuration details need to be the same across all kubelets involved in the cluster, while -other configuration aspects need to be set on a per-kubelet basis, to accommodate the different -characteristics of a given machine, such as OS, storage, and networking. You can manage the configuration -of your kubelets manually, but [kubeadm now provides a `KubeletConfiguration` API type for managing your +other configuration aspects need to be set on a per-kubelet basis to accommodate the different +characteristics of a given machine (such as OS, storage, and networking). You can manage the configuration +of your kubelets manually, but kubeadm now provides a `KubeletConfiguration` API type for [managing your kubelet configurations centrally](#configure-kubelets-using-kubeadm). {{% /capture %}} @@ -67,7 +67,7 @@ For more details on the ComponentConfig have a look at [this section](#configure ### Providing instance-specific configuration details -Some hosts require specific kubelet configurations, due to differences in hardware, operating system, +Some hosts require specific kubelet configurations due to differences in hardware, operating system, networking, or other host-specific parameters. The following list provides a few examples. - The path to the DNS resolution file, as specified by the `--resolv-conf` kubelet @@ -79,7 +79,7 @@ networking, or other host-specific parameters. The following list provides a few unless you are using a cloud provider. You can use the `--hostname-override` flag to override the default behavior if you need to specify a Node name different from the machine's hostname. -- Currently, the kubelet cannot automatically detects the cgroup driver used by the CRI runtime, +- Currently, the kubelet cannot automatically detect the cgroup driver used by the CRI runtime, but the value of `--cgroup-driver` must match the cgroup driver used by the CRI runtime to ensure the health of the kubelet. @@ -107,7 +107,7 @@ for more information on the individual fields. When you call `kubeadm init`, the kubelet configuration is marshalled to disk at `/var/lib/kubelet/config.yaml`, and also uploaded to a ConfigMap in the cluster. The ConfigMap -is named `kubelet-config-1.X`, where `.X` is the minor version of the Kubernetes version you are +is named `kubelet-config-1.X`, where `X` is the minor version of the Kubernetes version you are initializing. A kubelet configuration file is also written to `/etc/kubernetes/kubelet.conf` with the baseline cluster-wide configuration for all kubelets in the cluster. This configuration file points to the client certificates that allow the kubelet to communicate with the API server. This @@ -157,12 +157,12 @@ has finished performing the TLS Bootstrap. ## The kubelet drop-in file for systemd -kubeadm ships with configuration for how systemd should run the kubelet. +`kubeadm` ships with configuration for how systemd should run the kubelet. Note that the kubeadm CLI command never touches this drop-in file. -This configuration file installed by the `kubeadm` [DEB](https://github.com/kubernetes/kubernetes/blob/master/build/debs/10-kubeadm.conf) or [RPM package](https://github.com/kubernetes/kubernetes/blob/master/build/rpms/10-kubeadm.conf) is written to +This configuration file installed by the `kubeadm` [DEB](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/deb/kubeadm/10-kubeadm.conf) or [RPM package](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/rpm/kubeadm/10-kubeadm.conf) is written to `/etc/systemd/system/kubelet.service.d/10-kubeadm.conf` and is used by systemd. -It augments the basic [`kubelet.service` for RPM](https://github.com/kubernetes/kubernetes/blob/master/build/rpms/kubelet.service) (resp. [`kubelet.service` for DEB](https://github.com/kubernetes/kubernetes/blob/master/build/debs/kubelet.service))): +It augments the basic [`kubelet.service` for RPM](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/rpm/kubelet/kubelet.service) or [`kubelet.service` for DEB](https://github.com/kubernetes/release/blob/master/cmd/kubepkg/templates/latest/deb/kubelet/lib/systemd/system/kubelet.service): ```none [Service] From 8576da2d9e80b0a5d472a5cefdcbd48fde5dc7a8 Mon Sep 17 00:00:00 2001 From: Dan Roscigno Date: Tue, 5 May 2020 23:31:46 -0400 Subject: [PATCH 22/67] Update guestbook-logs-metrics-with-elk.md Fix path for `kube-state-metrics` --- .../stateless-application/guestbook-logs-metrics-with-elk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md b/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md index 94008289ee..948e6a2e1d 100644 --- a/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md +++ b/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md @@ -67,7 +67,7 @@ kubectl get pods --namespace=kube-system | grep kube-state ```shell git clone https://github.com/kubernetes/kube-state-metrics.git kube-state-metrics -kubectl create -f examples/standard +kubectl apply -f kube-state-metrics/examples/standard kubectl get pods --namespace=kube-system | grep kube-state-metrics ``` Verify that kube-state-metrics is running and ready @@ -78,7 +78,7 @@ kubectl get pods -n kube-system -l app.kubernetes.io/name=kube-state-metrics Output: ```shell NAME READY STATUS RESTARTS AGE -kube-state-metrics-89d656bf8-vdthm 2/2 Running 0 21s +kube-state-metrics-89d656bf8-vdthm 1/1 Running 0 21s ``` ## Clone the Elastic examples GitHub repo ```shell From 00ad32d54248fec90d4417355bf1891f6fdd26c6 Mon Sep 17 00:00:00 2001 From: DanRoscigno Date: Tue, 5 May 2020 23:57:03 -0400 Subject: [PATCH 23/67] correct scaling instructions --- .../guestbook-logs-metrics-with-elk.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md b/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md index 948e6a2e1d..ced3ba7ebc 100644 --- a/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md +++ b/content/en/docs/tutorials/stateless-application/guestbook-logs-metrics-with-elk.md @@ -357,10 +357,14 @@ The output: ```shell deployment.extensions/frontend scaled ``` +Scale the frontend back up to three pods: +```shell +kubectl scale --replicas=3 deployment/frontend +``` ## View the changes in Kibana See the screenshot, add the indicated filters and then add the columns to the view. You can see the ScalingReplicaSet entry that is marked, following from there to the top of the list of events shows the image being pulled, the volumes mounted, the pod starting, etc. -![Kibana Discover](https://raw.githubusercontent.com/elastic/examples/master/beats-k8s-send-anywhere/scaling-discover.png) +![Kibana Discover](https://raw.githubusercontent.com/elastic/examples/master/beats-k8s-send-anywhere/scaling-up.png) {{% /capture %}} From 78de298fa59fcc72d2c53eae1b3e193067ee03d2 Mon Sep 17 00:00:00 2001 From: Jay Beale Date: Tue, 5 May 2020 22:38:37 -0700 Subject: [PATCH 24/67] Documenting read-only rootfs for issue 17927 Issue 17927 (https://github.com/kubernetes/website/issues/17927) asks for a change to this task-focused doc on security-context. It notes that this doesn't mention read-only root filesystem, while it's documented in the PSP page. This adds a bullet for read-only rootfs, clarifies that the bulleted list isn't comprehensive, and tells someone reading the list where to find more. The link is copied from the existing What's Next link list. --- .../tasks/configure-pod-container/security-context.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/en/docs/tasks/configure-pod-container/security-context.md b/content/en/docs/tasks/configure-pod-container/security-context.md index 038fbcb97f..0c2bb05d0c 100644 --- a/content/en/docs/tasks/configure-pod-container/security-context.md +++ b/content/en/docs/tasks/configure-pod-container/security-context.md @@ -11,7 +11,7 @@ weight: 80 {{% capture overview %}} A security context defines privilege and access control settings for -a Pod or Container. Security context settings include: +a Pod or Container. Security context settings include, but are not limited to: * Discretionary Access Control: Permission to access an object, like a file, is based on [user ID (UID) and group ID (GID)](https://wiki.archlinux.org/index.php/users_and_groups). @@ -28,6 +28,12 @@ a Pod or Container. Security context settings include: * AllowPrivilegeEscalation: Controls whether a process can gain more privileges than its parent process. This bool directly controls whether the [`no_new_privs`](https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt) flag gets set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged OR 2) has `CAP_SYS_ADMIN`. +* readOnlyRootFilesystem: Mounts the container's root filesystem as read-only. + +The above bullets are not a complete set of security context settings -- please see +[SecurityContext](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#securitycontext-v1-core) +for a comprehensive list. + For more information about security mechanisms in Linux, see [Overview of Linux Kernel Security Features](https://www.linux.com/learn/overview-linux-kernel-security-features) From 14c07ede735ee29feb34e935db5f9415fbb3dd20 Mon Sep 17 00:00:00 2001 From: Nikhil Jagtiani Date: Wed, 6 May 2020 14:38:59 +0530 Subject: [PATCH 25/67] logs command to check etc/hosts file corrected hosts file can be viewed using exec command. --- .../add-entries-to-pod-etc-hosts-with-host-aliases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases.md b/content/en/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases.md index 6f931a8531..aeae348209 100644 --- a/content/en/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases.md +++ b/content/en/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases.md @@ -93,7 +93,7 @@ hostaliases-pod 0/1 Completed 0 6s 10.200 The `hosts` file content would look like this: ```shell -kubectl logs hostaliases-pod +kubectl exec hostaliases-pod -- cat /etc/hosts ``` ```none From 7607ff46239a7a5dae7bf581ee88ad2e1a6cf23d Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Wed, 6 May 2020 15:33:20 +0100 Subject: [PATCH 26/67] Signpost blog contributors to help (add a comment to the blog section index with advice on how to find the contributor guide) --- content/en/blog/_index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/en/blog/_index.md b/content/en/blog/_index.md index 2d534508aa..a16a4ffe49 100644 --- a/content/en/blog/_index.md +++ b/content/en/blog/_index.md @@ -8,3 +8,9 @@ menu: post: >

Read the latest news for Kubernetes and the containers space in general, and get technical how-tos hot off the presses.

--- +{{< comment >}} + +For information about contributing to the blog, see +https://kubernetes.io/docs/contribute/new-content/blogs-case-studies/#write-a-blog-post + +{{< /comment >}} From cf2d2b79709296ab09602eb10b6fec168da3f62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20B=C3=BCrgi?= Date: Wed, 6 May 2020 19:58:58 +0200 Subject: [PATCH 27/67] Pod lifecycle edge-cases for Recreate strategy Document Pod lifecycle behavior edge-case when using a Recreate strategy. This should document the "unexpected" behavior discussed in kubernetes/kubernetes#58814 --- .../en/docs/concepts/workloads/controllers/deployment.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/en/docs/concepts/workloads/controllers/deployment.md b/content/en/docs/concepts/workloads/controllers/deployment.md index 1fd6c5c9d6..c5751059f6 100644 --- a/content/en/docs/concepts/workloads/controllers/deployment.md +++ b/content/en/docs/concepts/workloads/controllers/deployment.md @@ -1081,6 +1081,15 @@ the default value. All existing Pods are killed before new ones are created when `.spec.strategy.type==Recreate`. +{{< note >}} +This will only guarantee Pod termination previous to creation for upgrades. If you upgrade a Deployment, all Pods +of the old revision will be terminated immediately. Successful removal is awaited before any Pod of the new +revision is created. If you manually delete a Pod, the lifecycle is controlled by the ReplicaSet and the +replacement will be created immediately (even if the old Pod is still in a Terminating state). If you need an +"at most" guarantee for your Pods, you should consider using a +[StatefulSet](/docs/concepts/workloads/controllers/statefulset/). +{{< /note >}} + #### Rolling Update Deployment The Deployment updates Pods in a rolling update From 236c65c18e71fbc0d62adf6c0bbe7ded74676fec Mon Sep 17 00:00:00 2001 From: Nikita Kalyanov <44959448+nikitakalyanov@users.noreply.github.com> Date: Wed, 6 May 2020 03:01:39 +0300 Subject: [PATCH 28/67] Remove reference to deprecated image The #20553 changed the deprecated hello-node image to echoserver image. However, there is a reference to the old image later in the text. Point 5 implies that there will be a 'Hello World' message. This probably was true for the hello-node image but the echoserver does not print this (it echoes back the request with all of its params). This may be misleading, so change the text to a generic 'app's response'/'sample app'. Unused JS sources of the old image are removed. --- content/en/docs/tutorials/hello-minikube.md | 16 +++++----------- content/en/examples/minikube/Dockerfile | 4 ---- content/en/examples/minikube/server.js | 9 --------- 3 files changed, 5 insertions(+), 24 deletions(-) delete mode 100644 content/en/examples/minikube/Dockerfile delete mode 100644 content/en/examples/minikube/server.js diff --git a/content/en/docs/tutorials/hello-minikube.md b/content/en/docs/tutorials/hello-minikube.md index e64cb16a73..afeae088aa 100644 --- a/content/en/docs/tutorials/hello-minikube.md +++ b/content/en/docs/tutorials/hello-minikube.md @@ -7,7 +7,7 @@ menu: title: "Get Started" weight: 10 post: > -

Ready to get your hands dirty? Build a simple Kubernetes cluster that runs "Hello World" for Node.js.

+

Ready to get your hands dirty? Build a simple Kubernetes cluster that runs a sample app.

card: name: tutorials weight: 10 @@ -15,7 +15,7 @@ card: {{% capture overview %}} -This tutorial shows you how to run a simple Hello World Node.js app +This tutorial shows you how to run a sample app on Kubernetes using [Minikube](/docs/setup/learning-environment/minikube) and Katacoda. Katacoda provides a free, in-browser Kubernetes environment. @@ -27,7 +27,7 @@ You can also follow this tutorial if you've installed [Minikube locally](/docs/t {{% capture objectives %}} -* Deploy a hello world application to Minikube. +* Deploy a sample application to Minikube. * Run the app. * View application logs. @@ -35,13 +35,7 @@ You can also follow this tutorial if you've installed [Minikube locally](/docs/t {{% capture prerequisites %}} -This tutorial provides a container image built from the following files: - -{{< codenew language="js" file="minikube/server.js" >}} - -{{< codenew language="conf" file="minikube/Dockerfile" >}} - -For more information on the `docker build` command, read the [Docker documentation](https://docs.docker.com/engine/reference/commandline/build/). +This tutorial provides a container image that uses NGINX to echo back all the requests. {{% /capture %}} @@ -166,7 +160,7 @@ Kubernetes [*Service*](/docs/concepts/services-networking/service/). 5. Katacoda environment only: Note the 5 digit port number displayed opposite to `8080` in services output. This port number is randomly generated and it can be different for you. Type your number in the port number text box, then click Display Port. Using the example from earlier, you would type `30369`. - This opens up a browser window that serves your app and shows the "Hello World" message. + This opens up a browser window that serves your app and shows the app's response. ## Enable addons diff --git a/content/en/examples/minikube/Dockerfile b/content/en/examples/minikube/Dockerfile deleted file mode 100644 index dd58cb7e75..0000000000 --- a/content/en/examples/minikube/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM node:6.14.2 -EXPOSE 8080 -COPY server.js . -CMD [ "node", "server.js" ] diff --git a/content/en/examples/minikube/server.js b/content/en/examples/minikube/server.js deleted file mode 100644 index 76345a17d8..0000000000 --- a/content/en/examples/minikube/server.js +++ /dev/null @@ -1,9 +0,0 @@ -var http = require('http'); - -var handleRequest = function(request, response) { - console.log('Received request for URL: ' + request.url); - response.writeHead(200); - response.end('Hello World!'); -}; -var www = http.createServer(handleRequest); -www.listen(8080); From 237551019fb6978ac461b3ad3085df219a52eaf6 Mon Sep 17 00:00:00 2001 From: Prasad Katti Date: Wed, 6 May 2020 18:03:06 -0700 Subject: [PATCH 29/67] Update feature state for APIListChunking APIListChunking is beta since v1.9 --- content/en/docs/reference/using-api/api-concepts.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/en/docs/reference/using-api/api-concepts.md b/content/en/docs/reference/using-api/api-concepts.md index 4d06194a59..956c31323d 100644 --- a/content/en/docs/reference/using-api/api-concepts.md +++ b/content/en/docs/reference/using-api/api-concepts.md @@ -109,6 +109,7 @@ To mitigate the impact of short history window, we introduced a concept of `book `Bookmark` events can be requested by `allowWatchBookmarks=true` option in watch requests, but clients shouldn't assume bookmarks are returned at any specific interval, nor may they assume the server will send any `bookmark` event. ## Retrieving large results sets in chunks +{{< feature-state for_k8s_version="v1.9" state="beta" >}} On large clusters, retrieving the collection of some resource types may result in very large responses that can impact the server and client. For instance, a cluster may have tens of thousands of pods, each of which is 1-2kb of encoded JSON. Retrieving all pods across all namespaces may result in a very large response (10-20MB) and consume a large amount of server resources. Starting in Kubernetes 1.9 the server supports the ability to break a single large collection request into many smaller chunks while preserving the consistency of the total request. Each chunk can be returned sequentially which reduces both the total size of the request and allows user-oriented clients to display results incrementally to improve responsiveness. From d8172b6aab7f44f64df96d493c0413dd0779e5a4 Mon Sep 17 00:00:00 2001 From: Kuralamudhan Ramakrishnan Date: Wed, 6 May 2020 20:39:53 -0700 Subject: [PATCH 30/67] Update networking.md --- content/en/docs/concepts/cluster-administration/networking.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/en/docs/concepts/cluster-administration/networking.md b/content/en/docs/concepts/cluster-administration/networking.md index f70e6f7a42..c260963d87 100644 --- a/content/en/docs/concepts/cluster-administration/networking.md +++ b/content/en/docs/concepts/cluster-administration/networking.md @@ -262,6 +262,10 @@ Lars Kellogg-Stedman. Multus supports all [reference plugins](https://github.com/containernetworking/plugins) (eg. [Flannel](https://github.com/containernetworking/plugins/tree/master/plugins/meta/flannel), [DHCP](https://github.com/containernetworking/plugins/tree/master/plugins/ipam/dhcp), [Macvlan](https://github.com/containernetworking/plugins/tree/master/plugins/main/macvlan)) that implement the CNI specification and 3rd party plugins (eg. [Calico](https://github.com/projectcalico/cni-plugin), [Weave](https://github.com/weaveworks/weave), [Cilium](https://github.com/cilium/cilium), [Contiv](https://github.com/contiv/netplugin)). In addition to it, Multus supports [SRIOV](https://github.com/hustcat/sriov-cni), [DPDK](https://github.com/Intel-Corp/sriov-cni), [OVS-DPDK & VPP](https://github.com/intel/vhost-user-net-plugin) workloads in Kubernetes with both cloud native and NFV based applications in Kubernetes. +### OVN4NFV-K8s-Plugin (OVN based CNI controller & plugin) + +[OVN4NFV-K8S-Plugin](https://github.com/opnfv/ovn4nfv-k8s-plugin) is OVN based CNI controller plugin to provide cloud native based Service function chaining(SFC), Multiple OVN overlay networking, dynamic subnet creation, dynamic creation of virtual networks, VLAN Provider network, Direct provider network and pluggable with other Multi-network plugins, ideal for edge based cloud native workloads in Multi-cluster networking + ### NSX-T [VMware NSX-T](https://docs.vmware.com/en/VMware-NSX-T/index.html) is a network virtualization and security platform. NSX-T can provide network virtualization for a multi-cloud and multi-hypervisor environment and is focused on emerging application frameworks and architectures that have heterogeneous endpoints and technology stacks. In addition to vSphere hypervisors, these environments include other hypervisors such as KVM, containers, and bare metal. From 1a04e1471dc943a8473380b310f6f6b6671dadc2 Mon Sep 17 00:00:00 2001 From: Kuralamudhan Ramakrishnan Date: Wed, 6 May 2020 20:52:14 -0700 Subject: [PATCH 31/67] adding OVN4NFV-K8S-Plugin in addons --- content/en/docs/concepts/cluster-administration/addons.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/en/docs/concepts/cluster-administration/addons.md b/content/en/docs/concepts/cluster-administration/addons.md index c7f3dd8909..0347327f13 100644 --- a/content/en/docs/concepts/cluster-administration/addons.md +++ b/content/en/docs/concepts/cluster-administration/addons.md @@ -30,6 +30,7 @@ Add-ons in each section are sorted alphabetically - the ordering does not imply * [Flannel](https://github.com/coreos/flannel/blob/master/Documentation/kubernetes.md) is an overlay network provider that can be used with Kubernetes. * [Knitter](https://github.com/ZTE/Knitter/) is a plugin to support multiple network interfaces in a Kubernetes pod. * [Multus](https://github.com/Intel-Corp/multus-cni) is a Multi plugin for multiple network support in Kubernetes to support all CNI plugins (e.g. Calico, Cilium, Contiv, Flannel), in addition to SRIOV, DPDK, OVS-DPDK and VPP based workloads in Kubernetes. +* [OVN4NFV-K8S-Plugin](https://github.com/opnfv/ovn4nfv-k8s-plugin) is OVN based CNI controller plugin to provide cloud native based Service function chaining(SFC), Multiple OVN overlay networking, dynamic subnet creation, dynamic creation of virtual networks, VLAN Provider network, Direct provider network and pluggable with other Multi-network plugins, ideal for edge based cloud native workloads in Multi-cluster networking * [NSX-T](https://docs.vmware.com/en/VMware-NSX-T/2.0/nsxt_20_ncp_kubernetes.pdf) Container Plug-in (NCP) provides integration between VMware NSX-T and container orchestrators such as Kubernetes, as well as integration between NSX-T and container-based CaaS/PaaS platforms such as Pivotal Container Service (PKS) and OpenShift. * [Nuage](https://github.com/nuagenetworks/nuage-kubernetes/blob/v5.1.1-1/docs/kubernetes-1-installation.rst) is an SDN platform that provides policy-based networking between Kubernetes Pods and non-Kubernetes environments with visibility and security monitoring. * [Romana](http://romana.io) is a Layer 3 networking solution for pod networks that also supports the [NetworkPolicy API](/docs/concepts/services-networking/network-policies/). Kubeadm add-on installation details available [here](https://github.com/romana/romana/tree/master/containerize). From 13aee8fe479db710d7b90f4e93bf15c8dd40342a Mon Sep 17 00:00:00 2001 From: wawa0210 Date: Thu, 7 May 2020 11:36:13 +0800 Subject: [PATCH 32/67] beta.kubernetes.io/os deprecated since v1.14, are targeted for removal in v1.18 --- .../windows/user-guide-windows-containers.md | 2 +- .../en/docs/tasks/configure-pod-container/configure-gmsa.md | 4 ++-- content/en/examples/windows/configmap-pod.yaml | 2 +- content/en/examples/windows/daemonset.yaml | 2 +- content/en/examples/windows/emptydir-pod.yaml | 2 +- content/en/examples/windows/hostpath-volume-pod.yaml | 2 +- content/en/examples/windows/secret-pod.yaml | 2 +- content/en/examples/windows/simple-pod.yaml | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/content/en/docs/setup/production-environment/windows/user-guide-windows-containers.md b/content/en/docs/setup/production-environment/windows/user-guide-windows-containers.md index a79cc80b59..aa1c1f3783 100644 --- a/content/en/docs/setup/production-environment/windows/user-guide-windows-containers.md +++ b/content/en/docs/setup/production-environment/windows/user-guide-windows-containers.md @@ -70,7 +70,7 @@ spec: - -command - "<#code used from https://gist.github.com/wagnerandrade/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ; ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='

Windows Container Web Server

' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='

IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus) } ; " nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows ``` {{< note >}} diff --git a/content/en/docs/tasks/configure-pod-container/configure-gmsa.md b/content/en/docs/tasks/configure-pod-container/configure-gmsa.md index 83d9dee596..8045ae9a02 100644 --- a/content/en/docs/tasks/configure-pod-container/configure-gmsa.md +++ b/content/en/docs/tasks/configure-pod-container/configure-gmsa.md @@ -154,7 +154,7 @@ spec: imagePullPolicy: Always name: iis nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows ``` Individual containers in a Pod spec can also specify the desired GMSA credspec using a per-container `securityContext.windowsOptions.gmsaCredentialSpecName` field. For example: @@ -185,7 +185,7 @@ spec: windowsOptions: gmsaCredentialSpecName: gmsa-Webapp1 nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows ``` As Pod specs with GMSA fields populated (as described above) are applied in a cluster, the following sequence of events take place: diff --git a/content/en/examples/windows/configmap-pod.yaml b/content/en/examples/windows/configmap-pod.yaml index e30939b367..661cb73dee 100644 --- a/content/en/examples/windows/configmap-pod.yaml +++ b/content/en/examples/windows/configmap-pod.yaml @@ -28,4 +28,4 @@ spec: name: example-config key: example.property.2 nodeSelector: - beta.kubernetes.io/os: windows \ No newline at end of file + kubernetes.io/os: windows \ No newline at end of file diff --git a/content/en/examples/windows/daemonset.yaml b/content/en/examples/windows/daemonset.yaml index d3a7bb6636..7483708fc7 100644 --- a/content/en/examples/windows/daemonset.yaml +++ b/content/en/examples/windows/daemonset.yaml @@ -17,5 +17,5 @@ spec: - name: foo image: microsoft/windowsservercore:1709 nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/en/examples/windows/emptydir-pod.yaml b/content/en/examples/windows/emptydir-pod.yaml index e164f2caeb..08d8091391 100644 --- a/content/en/examples/windows/emptydir-pod.yaml +++ b/content/en/examples/windows/emptydir-pod.yaml @@ -17,4 +17,4 @@ spec: - name: scratch-volume emptyDir: {} nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/en/examples/windows/hostpath-volume-pod.yaml b/content/en/examples/windows/hostpath-volume-pod.yaml index 843250c80c..d95e345b6c 100644 --- a/content/en/examples/windows/hostpath-volume-pod.yaml +++ b/content/en/examples/windows/hostpath-volume-pod.yaml @@ -11,7 +11,7 @@ spec: mountPath: "C:\\etc\\foo" readOnly: true nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows volumes: - name: foo hostPath: diff --git a/content/en/examples/windows/secret-pod.yaml b/content/en/examples/windows/secret-pod.yaml index f4a8122c0a..69ee9b1f1e 100644 --- a/content/en/examples/windows/secret-pod.yaml +++ b/content/en/examples/windows/secret-pod.yaml @@ -29,4 +29,4 @@ spec: name: mysecret key: password nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/en/examples/windows/simple-pod.yaml b/content/en/examples/windows/simple-pod.yaml index f056f3cf0a..0b1f0ed5c5 100644 --- a/content/en/examples/windows/simple-pod.yaml +++ b/content/en/examples/windows/simple-pod.yaml @@ -11,4 +11,4 @@ spec: ports: - containerPort: 80 nodeSelector: - "beta.kubernetes.io/os": windows + "kubernetes.io/os": windows From 5c864a067c9866330a4f3a46fe79c340acef4d58 Mon Sep 17 00:00:00 2001 From: wawa0210 Date: Thu, 7 May 2020 11:41:44 +0800 Subject: [PATCH 33/67] beta.kubernetes.io/os deprecated since v1.14, are targeted for removal in v1.18 --- .../windows/user-guide-windows-containers.md | 6 +++--- content/ja/examples/windows/configmap-pod.yaml | 2 +- content/ja/examples/windows/daemonset.yaml | 2 +- content/ja/examples/windows/emptydir-pod.yaml | 2 +- content/ja/examples/windows/hostpath-volume-pod.yaml | 2 +- content/ja/examples/windows/secret-pod.yaml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/content/ja/docs/setup/production-environment/windows/user-guide-windows-containers.md b/content/ja/docs/setup/production-environment/windows/user-guide-windows-containers.md index 44d136f60b..60429629af 100644 --- a/content/ja/docs/setup/production-environment/windows/user-guide-windows-containers.md +++ b/content/ja/docs/setup/production-environment/windows/user-guide-windows-containers.md @@ -64,7 +64,7 @@ To deploy a Windows container on Kubernetes, you must first create an example ap - -command - "<#code used from https://gist.github.com/wagnerandrade/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ; ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='

Windows Container Web Server

' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='

IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus) } ; " nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows ``` {{< note >}} @@ -113,8 +113,8 @@ Users today need to use some combination of taints and node selectors in order t Users can ensure Windows containers can be scheduled on the appropriate host using Taints and Tolerations. All Kubernetes nodes today have the following default labels: -* beta.kubernetes.io/os = [windows|linux] -* beta.kubernetes.io/arch = [amd64|arm64|...] +* kubernetes.io/os = [windows|linux] +* kubernetes.io/arch = [amd64|arm64|...] If a Pod specification does not specify a nodeSelector like `"beta.kubernetes.io/os": windows`, it is possible the Pod can be scheduled on any host, Windows or Linux. This can be problematic since a Windows container can only run on Windows and a Linux container can only run on Linux. The best practice is to use a nodeSelector. diff --git a/content/ja/examples/windows/configmap-pod.yaml b/content/ja/examples/windows/configmap-pod.yaml index e30939b367..661cb73dee 100644 --- a/content/ja/examples/windows/configmap-pod.yaml +++ b/content/ja/examples/windows/configmap-pod.yaml @@ -28,4 +28,4 @@ spec: name: example-config key: example.property.2 nodeSelector: - beta.kubernetes.io/os: windows \ No newline at end of file + kubernetes.io/os: windows \ No newline at end of file diff --git a/content/ja/examples/windows/daemonset.yaml b/content/ja/examples/windows/daemonset.yaml index d3a7bb6636..7483708fc7 100644 --- a/content/ja/examples/windows/daemonset.yaml +++ b/content/ja/examples/windows/daemonset.yaml @@ -17,5 +17,5 @@ spec: - name: foo image: microsoft/windowsservercore:1709 nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/ja/examples/windows/emptydir-pod.yaml b/content/ja/examples/windows/emptydir-pod.yaml index e164f2caeb..08d8091391 100644 --- a/content/ja/examples/windows/emptydir-pod.yaml +++ b/content/ja/examples/windows/emptydir-pod.yaml @@ -17,4 +17,4 @@ spec: - name: scratch-volume emptyDir: {} nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/ja/examples/windows/hostpath-volume-pod.yaml b/content/ja/examples/windows/hostpath-volume-pod.yaml index 843250c80c..d95e345b6c 100644 --- a/content/ja/examples/windows/hostpath-volume-pod.yaml +++ b/content/ja/examples/windows/hostpath-volume-pod.yaml @@ -11,7 +11,7 @@ spec: mountPath: "C:\\etc\\foo" readOnly: true nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows volumes: - name: foo hostPath: diff --git a/content/ja/examples/windows/secret-pod.yaml b/content/ja/examples/windows/secret-pod.yaml index f4a8122c0a..69ee9b1f1e 100644 --- a/content/ja/examples/windows/secret-pod.yaml +++ b/content/ja/examples/windows/secret-pod.yaml @@ -29,4 +29,4 @@ spec: name: mysecret key: password nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows From de2b6f3d94c8e76d65e93552bb6d0bf9566f0fc0 Mon Sep 17 00:00:00 2001 From: wawa0210 Date: Thu, 7 May 2020 11:44:50 +0800 Subject: [PATCH 34/67] beta.kubernetes.io/os deprecated since v1.14, are targeted for removal in v1.18 --- .../windows/user-guide-windows-containers.md | 2 +- content/zh/examples/windows/configmap-pod.yaml | 2 +- content/zh/examples/windows/daemonset.yaml | 2 +- content/zh/examples/windows/emptydir-pod.yaml | 2 +- content/zh/examples/windows/hostpath-volume-pod.yaml | 2 +- content/zh/examples/windows/secret-pod.yaml | 2 +- content/zh/examples/windows/simple-pod.yaml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/content/zh/docs/setup/production-environment/windows/user-guide-windows-containers.md b/content/zh/docs/setup/production-environment/windows/user-guide-windows-containers.md index 74790f03c9..aeec416870 100644 --- a/content/zh/docs/setup/production-environment/windows/user-guide-windows-containers.md +++ b/content/zh/docs/setup/production-environment/windows/user-guide-windows-containers.md @@ -100,7 +100,7 @@ spec: - -command - "<#code used from https://gist.github.com/wagnerandrade/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ; ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='

Windows Container Web Server

' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='

IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus) } ; " nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows ``` {{< note >}} diff --git a/content/zh/examples/windows/configmap-pod.yaml b/content/zh/examples/windows/configmap-pod.yaml index e30939b367..661cb73dee 100644 --- a/content/zh/examples/windows/configmap-pod.yaml +++ b/content/zh/examples/windows/configmap-pod.yaml @@ -28,4 +28,4 @@ spec: name: example-config key: example.property.2 nodeSelector: - beta.kubernetes.io/os: windows \ No newline at end of file + kubernetes.io/os: windows \ No newline at end of file diff --git a/content/zh/examples/windows/daemonset.yaml b/content/zh/examples/windows/daemonset.yaml index d3a7bb6636..7483708fc7 100644 --- a/content/zh/examples/windows/daemonset.yaml +++ b/content/zh/examples/windows/daemonset.yaml @@ -17,5 +17,5 @@ spec: - name: foo image: microsoft/windowsservercore:1709 nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/zh/examples/windows/emptydir-pod.yaml b/content/zh/examples/windows/emptydir-pod.yaml index e164f2caeb..08d8091391 100644 --- a/content/zh/examples/windows/emptydir-pod.yaml +++ b/content/zh/examples/windows/emptydir-pod.yaml @@ -17,4 +17,4 @@ spec: - name: scratch-volume emptyDir: {} nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/zh/examples/windows/hostpath-volume-pod.yaml b/content/zh/examples/windows/hostpath-volume-pod.yaml index 843250c80c..d95e345b6c 100644 --- a/content/zh/examples/windows/hostpath-volume-pod.yaml +++ b/content/zh/examples/windows/hostpath-volume-pod.yaml @@ -11,7 +11,7 @@ spec: mountPath: "C:\\etc\\foo" readOnly: true nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows volumes: - name: foo hostPath: diff --git a/content/zh/examples/windows/secret-pod.yaml b/content/zh/examples/windows/secret-pod.yaml index f4a8122c0a..69ee9b1f1e 100644 --- a/content/zh/examples/windows/secret-pod.yaml +++ b/content/zh/examples/windows/secret-pod.yaml @@ -29,4 +29,4 @@ spec: name: mysecret key: password nodeSelector: - beta.kubernetes.io/os: windows + kubernetes.io/os: windows diff --git a/content/zh/examples/windows/simple-pod.yaml b/content/zh/examples/windows/simple-pod.yaml index f056f3cf0a..0b1f0ed5c5 100644 --- a/content/zh/examples/windows/simple-pod.yaml +++ b/content/zh/examples/windows/simple-pod.yaml @@ -11,4 +11,4 @@ spec: ports: - containerPort: 80 nodeSelector: - "beta.kubernetes.io/os": windows + "kubernetes.io/os": windows From d2d4ba26d0dc2594443654613bfe210cbb00be4d Mon Sep 17 00:00:00 2001 From: Aris Cahyadi Risdianto Date: Sun, 12 Apr 2020 22:37:44 +0800 Subject: [PATCH 35/67] ID Localization for Monitoring Revert "ID Localization for Monitoring" This reverts commit ff9ddc1e6947d1c5a7a3218e7686f4963b103d81. Fixing directory problem. Fixing some translated words. Fixed "deprecation/deprecated metrics policy" Final check and modification. --- .../cluster-administration/monitoring.md | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 content/id/docs/concepts/cluster-administration/monitoring.md diff --git a/content/id/docs/concepts/cluster-administration/monitoring.md b/content/id/docs/concepts/cluster-administration/monitoring.md new file mode 100644 index 0000000000..501719a757 --- /dev/null +++ b/content/id/docs/concepts/cluster-administration/monitoring.md @@ -0,0 +1,167 @@ +--- +title: Metrik-Metrik untuk Control Plane Kubernetes +content_template: templates/concept +weight: 60 +aliases: +- controller-metrics.md +--- + +{{% capture overview %}} + +Metrik dari komponen sistem dapat memberikan pandangan yang lebih baik tentang apa +yang sedang terjadi di dalam sistem. Metrik sangat berguna untuk membuat dasbor (_dashboard_) +dan peringatan (_alert_). + +Metrik di dalam _control plane_ Kubernetes disajikan dalam [format prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) +dan dapat terbaca oleh manusia. + +{{% /capture %}} + +{{% capture body %}} + +## Metrik-Metrik pada Kubernetes + +Dalam kebanyakan kasus, metrik tersedia pada _endpoint_ `/metrics` dari server HTTP. +Untuk komponen yang tidak mengekspos _endpoint_ secara bawaan, _endpoint_ tersebut dapat diaktifkan +dengan menggunakan opsi `--bind-address`. + +Contoh-contoh untuk komponen tersebut adalah: + +* {{< glossary_tooltip term_id="kube-controller-manager" text="kube-controller-manager" >}} +* {{< glossary_tooltip term_id="kube-proxy" text="kube-proxy" >}} +* {{< glossary_tooltip term_id="kube-apiserver" text="kube-apiserver" >}} +* {{< glossary_tooltip term_id="kube-scheduler" text="kube-scheduler" >}} +* {{< glossary_tooltip term_id="kubelet" text="kubelet" >}} + +Di dalam lingkungan produksi, kamu mungkin ingin mengonfigurasi [Server Prometheus](https://prometheus.io/) +atau _scraper_ metrik (pengambil metrik) lainnya untuk mengumpulkan metrik-metrik ini secara berkala +dan membuatnya tersedia dalam semacam basis data yang _time series_. + +Perlu dicatat bahwa {{< glossary_tooltip term_id="kubelet" text="kubelet" >}} +juga mengekspos metrik pada _endpoint-endpoint_ seperti `/metrics/cadvisor`, +`/metrics/resource` dan `/metrics/probes`. Metrik-metrik tersebut tidak memiliki +siklus hidup yang sama. + +Jika klaster kamu menggunakan {{< glossary_tooltip term_id="rbac" text="RBAC" >}}, +untuk membaca metrik memerlukan otorisasi melalui sebuah User, Group, atau +ServiceAccount dengan ClusterRole yang memperbolehkan mengakses `/metrics`. + +Sebagai contoh: + +``` +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: prometheus +rules: + - nonResourceURLs: + - "/metrics" + verbs: + - get +``` + +## Siklus Hidup (_Lifecycle_) Metrik + +Alpha metric → Stable metric → Deprecated metric → Hidden metric → Deletion + +Metrik-metrik _Alpha_ tidak memiliki jaminan stabilitas; dengan demikian mereka +dapat dimodifikasi atau dihapus kapan saja. + +Metrik-metrik _Stable_ dijamin tidak berubah (dijamin stabilitasnya); Secara khusus, stabilitas berarti: + +* metrik itu sendiri tidak akan dihapus (atau diganti namanya) +* jenis metrik tidak akan dimodifikasi + +Metrik _Deprecated_ memberi penanda bahwa metrik tersebut suatu saat akan dihapus; untuk +menemukan versi yang mana, kamu perlu memeriksa anotasi, yang mencakup dari versi +Kubernetes mana yang metrik tersebut akan dianggap _deprecated_. + +Sebelum _deprecation_: + +``` +# HELP some_counter this counts things +# TYPE some_counter counter +some_counter 0 +``` + +Sesudah _deprecation_: + +``` +# HELP some_counter (Deprecated since 1.15.0) this counts things +# TYPE some_counter counter +some_counter 0 +``` + +Setelah metrik disembunyikan maka secara bawaan metrik tidak dipublikasikan +untuk _scraping_ (pengambilan metrik). Untuk menggunakan metrik yang tersembunyi, kamu perlu mengganti (_override_) +konfigurasi untuk komponen klaster yang relevan. + +Setelah metrik dihapus, metrik tidak dipublikasikan. Kamu tidak dapat mengubah +metrik tersebut dengan menggunakan _override_. + +## Melihat Metrik tersembunyi + +Seperti dijelaskan di atas, para admin dapat mengaktifkan metrik tersembunyi +melalui opsi pada baris perintah (_command line_) untuk _binary_ (program) tertentu. Ini ditujukan untuk +digunakan sebagai solusi bagi para admin apabila mereka gagal memigrasi +metrik yang sudah _deprecated_ dalam rilis terakhir. + +Opsi `show-hidden-metrics-for-version` menunjukkan versi yang ingin kamu tampilkan +metrik yang sudah _deprecated_ dalam rilis tersebut. Versi ini ditampilkan dalam bentuk x.y, +di mana x adalah versi _major_, y ​​adalah versi minor. Versi _patch_ tidak +diperlukan meskipun metrik dapat di_-deprecate_ dalam rilis _patch_, hal ini +adalah karena kebijakan _deprecation_ untuk metrik hanya berlaku terhadap rilis minor. + +Opsi tersebut hanya dapat menggunakan versi minor sebelumnya sebagai parameternya. Semua +metrik yang disembunyikan di versi sebelumnya akan dikeluarkan jika para admin +mengatur versi sebelumnya ke `show-hidden-metrics-for-version`. Versi yang +terlalu lama tidak diizinkan karena hal ini melanggar kebijakan untuk metrik yang +sudah _deprecated_. + +Ambil metrik `A` sebagai contoh, di sini diasumsikan bahwa `A` sudah _deprecated_ +pada rilis 1.n. Menurut kebijakan metrik yang sudah _deprecated_, kita dapat mencapai kesimpulan +sebagai berikut: + +* Pada rilis `1.n`, metrik sudah di_-deprecated_, dan dapat diperlihatkan secara bawaan. +* Pada rilis `1.n + 1`, metrik disembunyikan secara bawaan dan dapat + diperlihatkan dengan baris perintah `show-hidden-metrics-for-version=1.n`. +* Pada rilis `1.n + 2`, metrik harus dihapus dari _codebase_. Tidak ada jalan + keluar lagi. + +Jika kamu meng-_upgrade_ dari rilis `1.12` ke` 1.13`, tetapi masih bergantung pada +metrik `A` yang di-_deprecate_ dalam` 1.12`, kamu harus mengatur metrik +tersembunyi melalui baris perintah: `--show-hidden-metrics=1.12` dan ingatlah +untuk menghapus ketergantungan terhadap metrik ini sebelum meng-_upgrade_ ke `1.14`. + +## Metrik komponen + +### Metrik kube-controller-manager + +Metrik Controller Manager memberikan pandangan penting +tentang kinerja dan kesehatan Controller Manager. Metrik ini mencakup metrik +_runtime_ berbahasa Go yang umum seperti jumlah _go_routine_ dan metrik khusus +pengontrol seperti latensi _request etcd_ atau latensi API dari Cloud provider +(AWS, GCE, OpenStack) yang dapat digunakan untuk mengukur kesehatan klaster. + +Mulai dari Kubernetes 1.7, metrik Cloud provider yang detail tersedia untuk +operasi penyimpanan untuk GCE, AWS, Vsphere, dan OpenStack. +Metrik ini dapat digunakan untuk memantau kesehatan operasi PersistentVolume. + +Misalnya, untuk GCE metrik tersebut adalah: + +``` +cloudprovider_gce_api_request_duration_seconds { request = "instance_list"} +cloudprovider_gce_api_request_duration_seconds { request = "disk_insert"} +cloudprovider_gce_api_request_duration_seconds { request = "disk_delete"} +cloudprovider_gce_api_request_duration_seconds { request = "attach_disk"} +cloudprovider_gce_api_request_duration_seconds { request = "detach_disk"} +cloudprovider_gce_api_request_duration_seconds { request = "list_disk"} +``` + +{{% /capture %}} + +{{% capture whatsnext %}} +* Baca tentang [format teks Prometheus](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format) untuk berbagai metrik +* Lihat daftar [metrik Kubernetes yang _stable_](https://github.com/kubernetes/kubernetes/blob/master/test/instrumentation/testdata/stable-metrics-list.yaml) +* Baca tentang [kebijakan _deprecation_ Kubernetes](https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-feature-or-behavior ) +{{% /capture %}} From 98a90113bc16c18e11613b191fd85503b8c5b8da Mon Sep 17 00:00:00 2001 From: Juampy NR Date: Thu, 7 May 2020 10:18:06 +0200 Subject: [PATCH 36/67] Fix syntax error --- content/en/docs/tutorials/stateless-application/guestbook.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/tutorials/stateless-application/guestbook.md b/content/en/docs/tutorials/stateless-application/guestbook.md index f1f93dd988..e8c71bc613 100644 --- a/content/en/docs/tutorials/stateless-application/guestbook.md +++ b/content/en/docs/tutorials/stateless-application/guestbook.md @@ -116,7 +116,7 @@ Although the Redis master is a single pod, you can make it highly available to m Deployments scale based off of the configurations set in the manifest file. In this case, the Deployment object specifies two replicas. -If there are not any replicas running, this Deployment would start the two replicas on your container cluster. Conversely, if there are more than two replicas are running, it would scale down until two replicas are running. +If there are not any replicas running, this Deployment would start the two replicas on your container cluster. Conversely, if there are more than two replicas running, it would scale down until two replicas are running. {{< codenew file="application/guestbook/redis-slave-deployment.yaml" >}} From 8d64525e6b43142e40e7e9f218ad50fd49c1e7c0 Mon Sep 17 00:00:00 2001 From: Evan Adi Date: Sun, 19 Apr 2020 14:30:12 +0700 Subject: [PATCH 37/67] Translate configure-pod-configmap to Bahasa Indonesia Add example yaml Add more missing example yamls Fix namespace term_id Translate comments in example files Update example files with ID versions Add _index.md Fix nits: + translate item to butir + fix typos + add backticks for words contained in snippets + camelcase API objects + fix broken anchors + use singular form of imported words Fix nits: + use dikontainerisasi Fix nits: + fix one broken anchor --- .../tasks/configure-pod-container/_index.md | 5 + .../configure-pod-configmap.md | 684 ++++++++++++++++++ .../configmap/configmap-multikeys.yaml | 8 + content/id/examples/configmap/configmaps.yaml | 15 + .../pods/pod-configmap-env-var-valueFrom.yaml | 21 + .../examples/pods/pod-configmap-envFrom.yaml | 13 + .../pod-configmap-volume-specific-key.yaml | 20 + .../examples/pods/pod-configmap-volume.yaml | 19 + .../pod-multiple-configmap-env-variable.yaml | 21 + .../pod-single-configmap-env-variable.yaml | 19 + 10 files changed, 825 insertions(+) create mode 100755 content/id/docs/tasks/configure-pod-container/_index.md create mode 100644 content/id/docs/tasks/configure-pod-container/configure-pod-configmap.md create mode 100644 content/id/examples/configmap/configmap-multikeys.yaml create mode 100644 content/id/examples/configmap/configmaps.yaml create mode 100644 content/id/examples/pods/pod-configmap-env-var-valueFrom.yaml create mode 100644 content/id/examples/pods/pod-configmap-envFrom.yaml create mode 100644 content/id/examples/pods/pod-configmap-volume-specific-key.yaml create mode 100644 content/id/examples/pods/pod-configmap-volume.yaml create mode 100644 content/id/examples/pods/pod-multiple-configmap-env-variable.yaml create mode 100644 content/id/examples/pods/pod-single-configmap-env-variable.yaml diff --git a/content/id/docs/tasks/configure-pod-container/_index.md b/content/id/docs/tasks/configure-pod-container/_index.md new file mode 100755 index 0000000000..65d61d64fa --- /dev/null +++ b/content/id/docs/tasks/configure-pod-container/_index.md @@ -0,0 +1,5 @@ +--- +title: "Mengatur Pod dan Kontainer" +weight: 20 +--- + diff --git a/content/id/docs/tasks/configure-pod-container/configure-pod-configmap.md b/content/id/docs/tasks/configure-pod-container/configure-pod-configmap.md new file mode 100644 index 0000000000..3d678ad75f --- /dev/null +++ b/content/id/docs/tasks/configure-pod-container/configure-pod-configmap.md @@ -0,0 +1,684 @@ +--- +title: Mengatur Pod untuk Menggunakan ConfigMap +content_template: templates/task +weight: 150 +card: + name: tasks + weight: 50 +--- + +{{% capture overview %}} +ConfigMap mengizinkan kamu untuk memisahkan artifak-artifak konfigurasi dari konten _image_ untuk menjaga aplikasi yang dikontainerisasi tetap portabel. Artikel ini menyediakan sekumpulan contoh penerapan yang mendemonstrasikan bagaimana cara membuat ConfigMap dan mengatur Pod menggunakan data yang disimpan di dalam ConfigMap. + +{{% /capture %}} + +{{% capture prerequisites %}} + +{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} + +{{% /capture %}} + +{{% capture steps %}} + + +## Membuat ConfigMap +Kamu dapat menggunakan `kubectl create configmap` ataupun generator ConfigMap pada `kustomization.yaml` untuk membuat sebuah ConfigMap. Perlu diingat bahwa `kubectl` mulai mendukung `kustomization.yaml` sejak versi 1.14. + +### Membuat ConfigMap Menggunakan kubectl create configmap + +Gunakan perintah `kubectl create configmap` untuk membuat ConfigMap dari [direktori](#membuat-configmap-dari-direktori), [berkas](#membuat-configmap-dari-berkas), ataupun [nilai-nilai yang harfiah (_literal values_)](#membuat-configmap-dari-nilai-harfiah): + +```shell +kubectl create configmap +``` + +di mana \ merupakan nama yang ingin kamu berikan pada ConfigMap tersebut dan \ adalah direktori, berkas, atau nilai harfiah yang digunakan sebagai sumber data. +Nama dari sebuah objek ConfigMap haruslah berupa +[nama subdomain DNS](/docs/concepts/overview/working-with-objects/names#dns-subdomain-names) yang sah. + +Ketika kamu membuat ConfigMap dari sebuah berkas, secara bawaan, _basename_ dari berkas tersebut akan menjadi kunci pada \, dan isi dari berkas tersebut akan menjadi nilai dari kunci tersebut. + +Kamu dapat menggunakan [`kubectl describe`](/docs/reference/generated/kubectl/kubectl-commands/#describe) atau +[`kubectl get`](/docs/reference/generated/kubectl/kubectl-commands/#get) untuk mengambil informasi +mengenai sebuah ConfigMap. + +#### Membuat ConfigMap dari direktori + +Kamu dapat menggunakan `kubectl create configmap` untuk membuat sebuah ConfigMap dari banyak berkas dalam sebuah direktori yang sama. Ketika kamu membuat sebuah ConfigMap dari sebuah direktori, kubectl akan mengidentifikasi berkas-berkas yang memiliki _basename_ yang merupakan sebuah kunci yang sah pada direktori dan mengemas tiap berkas tersebut ke dalam sebuah ConfigMap baru. Seluruh entri direktori kecuali berkas reguler akan diabaikan (subdirektori, _symlink_, _device_, _pipe_, dsb). + +Sebagai contoh: + +```shell +# Membuat direktori lokal +mkdir -p configure-pod-container/configmap/ + +# Mengunduh berkas-berkas sampel ke dalam direktori `configure-pod-container/configmap/` +wget https://kubernetes.io/examples/configmap/game.properties -O configure-pod-cont1ainer/configmap/game.properties +wget https://kubernetes.io/examples/configmap/ui.properties -O configure-pod-container/configmap/ui.properties + +# Membuat configmap +kubectl create configmap game-config --from-file=configure-pod-container/configmap/ +``` + +Perintah di atas mengemas tiap berkas, dalam kasus ini, `game.properties` dan `ui.properties` dalam direktori `configure-pod-container/configmap/` ke dalam ConfigMap dengan nama game-config. Kamu dapat menampilkan detail dari ConfigMap menggunakan perintah berikut: + +```shell +kubectl describe configmaps game-config +``` + +Keluaran akan tampil seperti berikut: +``` +Name: game-config +Namespace: default +Labels: +Annotations: + +Data +==== +game.properties: +---- +enemies=aliens +lives=3 +enemies.cheat=true +enemies.cheat.level=noGoodRotten +secret.code.passphrase=UUDDLRLRBABAS +secret.code.allowed=true +secret.code.lives=30 +ui.properties: +---- +color.good=purple +color.bad=yellow +allow.textmode=true +how.nice.to.look=fairlyNice +``` + +Berkas-berkas `game.properties` dan `ui.properties` pada direktori `configure-pod-container/configmap/` direpresentasikan oleh bagian `data` pada ConfigMap. + +```shell +kubectl get configmaps game-config -o yaml +``` +Keluaran akan tampil seperti berikut: + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2016-02-18T18:52:05Z + name: game-config + namespace: default + resourceVersion: "516" + uid: b4952dc3-d670-11e5-8cd0-68f728db1985 +data: + game.properties: | + enemies=aliens + lives=3 + enemies.cheat=true + enemies.cheat.level=noGoodRotten + secret.code.passphrase=UUDDLRLRBABAS + secret.code.allowed=true + secret.code.lives=30 + ui.properties: | + color.good=purple + color.bad=yellow + allow.textmode=true + how.nice.to.look=fairlyNice +``` + +#### Membuat ConfigMap dari berkas + +Kamu dapat menggunakan `kubectl create configmap` untuk membuat sebuah ConfigMap dari berkas individual, atau dari banyak berkas. + +Sebagai contoh, + +```shell +kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties +``` + +akan menghasilkan ConfigMap berikut: + +```shell +kubectl describe configmaps game-config-2 +``` + +dengan keluaran seperti berikut: + +``` +Name: game-config-2 +Namespace: default +Labels: +Annotations: + +Data +==== +game.properties: +---- +enemies=aliens +lives=3 +enemies.cheat=true +enemies.cheat.level=noGoodRotten +secret.code.passphrase=UUDDLRLRBABAS +secret.code.allowed=true +secret.code.lives=30 +``` + +Kamu dapat memasukkan argumen `--from-file` beberapa kali untuk membuat sebuah ConfigMap dari banyak sumber data. + +```shell +kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties +``` + +Kamu dapat menampilkan detail dari ConfigMap `game-config-2` menggunakan perintah berikut: + +```shell +kubectl describe configmaps game-config-2 +``` + +Keluaran akan tampil seperti berikut: + +``` +Name: game-config-2 +Namespace: default +Labels: +Annotations: + +Data +==== +game.properties: +---- +enemies=aliens +lives=3 +enemies.cheat=true +enemies.cheat.level=noGoodRotten +secret.code.passphrase=UUDDLRLRBABAS +secret.code.allowed=true +secret.code.lives=30 +ui.properties: +---- +color.good=purple +color.bad=yellow +allow.textmode=true +how.nice.to.look=fairlyNice +``` + +Gunakan opsi `--from-env-file` untuk membuat sebuah ConfigMap dari sebuah _env-file_, sebagai contoh: + +```shell +# Env-file berisi sebuah daftar variabel _environment_. +# Ada aturan-aturan sintaks yang berlaku: +# Tiap baris pada sebuah env file harus memiliki format VAR=VAL. +# Baris yang diawali # (komentar) akan diabaikan. +# Baris-baris kosong akan diabaikan. +# Tidak ada penanganan spesial untuk tanda kutip (tanda kutip akan menjadi bagian dari nilai pada ConfigMap). + +# Mengunduh berkas-berkas sampel berikut ke dalam direktori `configure-pod-container/configmap/` +wget https://kubernetes.io/examples/configmap/game-env-file.properties -O configure-pod-container/configmap/game-env-file.properties + +# Berkas env-file `game-env-file.properties` berisi sebagai berikut: +cat configure-pod-container/configmap/game-env-file.properties +enemies=aliens +lives=3 +allowed="true" + +# Komentar ini dan baris kosong di atasnya akan diabaikan. +``` + +```shell +kubectl create configmap game-config-env-file \ + --from-env-file=configure-pod-container/configmap/game-env-file.properties +``` + +akan menghasilkan ConfigMap sebagai berikut: + +```shell +kubectl get configmap game-config-env-file -o yaml +``` + +dengan keluaran seperti berikut: +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2017-12-27T18:36:28Z + name: game-config-env-file + namespace: default + resourceVersion: "809965" + uid: d9d1ca5b-eb34-11e7-887b-42010a8002b8 +data: + allowed: '"true"' + enemies: aliens + lives: "3" +``` + +{{< caution >}} +Ketika memasukkan `--from-env-file` beberapa kali untuk membuat sebuah ConfigMap dari beberapa sumber data, hanya env-file terakhir yang akan digunakan. +{{< /caution >}} + +Contoh perilaku memasukkan `--from-env-file` beberapa kali didemonstrasikan dengan: + +```shell +# Mengunduh berkas-berkas sampel berikut ke dalam direktori `configure-pod-container/configmap/` +wget https://kubernetes.io/examples/configmap/ui-env-file.properties -O configure-pod-container/configmap/ui-env-file.properties + +# Membuat configmap +kubectl create configmap config-multi-env-files \ + --from-env-file=configure-pod-container/configmap/game-env-file.properties \ + --from-env-file=configure-pod-container/configmap/ui-env-file.properties +``` + +akan menghasilkan ConfigMap sebagai berikut: + +```shell +kubectl get configmap config-multi-env-files -o yaml +``` + +dengan keluaran seperti berikut: +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2017-12-27T18:38:34Z + name: config-multi-env-files + namespace: default + resourceVersion: "810136" + uid: 252c4572-eb35-11e7-887b-42010a8002b8 +data: + color: purple + how: fairlyNice + textmode: "true" +``` + +#### Menentukan kunci yang akan digunakan ketika membuat ConfigMap dari sebuah berkas + +Kamu dapat menentukan kunci selain dari nama berkas untuk digunakan pada bagian `data` pada ConfigMap yang kamu buat menggunakan argumen `--from-file`: + +```shell +kubectl create configmap game-config-3 --from-file== +``` + +di mana `` merupakan kunci yang ingin kamu gunakan pada ConfigMap dan `` merupakan lokasi dari berkas sumber data yang akan menjadi nilai dari kunci tersebut. + +Sebagai contoh: + +```shell +kubectl create configmap game-config-3 --from-file=game-special-key=configure-pod-container/configmap/game.properties +``` + +akan menghasilkan ConfigMap sebagai berikut: +``` +kubectl get configmaps game-config-3 -o yaml +``` + +dengan keluaran seperti berikut: +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2016-02-18T18:54:22Z + name: game-config-3 + namespace: default + resourceVersion: "530" + uid: 05f8da22-d671-11e5-8cd0-68f728db1985 +data: + game-special-key: | + enemies=aliens + lives=3 + enemies.cheat=true + enemies.cheat.level=noGoodRotten + secret.code.passphrase=UUDDLRLRBABAS + secret.code.allowed=true + secret.code.lives=30 +``` + +#### Membuat ConfigMap dari nilai harfiah + +Kamu dapat menggunakan `kubectl create configmap` dengan argumen `--from-literal` untuk menentukan nilai harfiah dari baris perintah: + +```shell +kubectl create configmap special-config --from-literal=special.how=very --from-literal=special.type=charm +``` + +Kamu dapat memasukkan beberapa pasang kunci-nilai. Tiap pasang yang dimasukkan pada _command line_ direpresentasikan sebagai sebuah entri terpisah pada bagian `data` dari ConfigMap. + +```shell +kubectl get configmaps special-config -o yaml +``` + +Keluaran akan tampil seperti berikut: +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2016-02-18T19:14:38Z + name: special-config + namespace: default + resourceVersion: "651" + uid: dadce046-d673-11e5-8cd0-68f728db1985 +data: + special.how: very + special.type: charm +``` + +### Membuat ConfigMap dari generator +`kubectl` mendukung `kustomization.yaml` sejak versi 1.14. +Kamu juga dapat membuat ConfigMap dari generator lalu menggunakannya untuk membuat objek tersebut pada +peladen API. Generator +harus dituliskan pada `kustomization.yaml` dalam sebuah direktori. + +#### Menghasilkan ConfigMap dari berkas +Sebagai contoh, untuk menghasilkan ConfigMap dari berkas `configure-pod-container/configmap/game.properties` +```shell +# Membuat berkas kustomization.yaml dengan ConfigMapGenerator +cat <./kustomization.yaml +configMapGenerator: +- name: game-config-4 + files: + - configure-pod-container/configmap/game.properties +EOF +``` + +Gunakan direktori kustomization untuk membuat objek ConfigMap. +```shell +kubectl apply -k . +configmap/game-config-4-m9dm2f92bt created +``` + +Kamu dapat melihat ConfigMap yang dihasilkan seperti berikut: + +```shell +kubectl get configmap +NAME DATA AGE +game-config-4-m9dm2f92bt 1 37s + + +kubectl describe configmaps/game-config-4-m9dm2f92bt +Name: game-config-4-m9dm2f92bt +Namespace: default +Labels: +Annotations: kubectl.kubernetes.io/last-applied-configuration: + {"apiVersion":"v1","data":{"game.properties":"enemies=aliens\nlives=3\nenemies.cheat=true\nenemies.cheat.level=noGoodRotten\nsecret.code.p... + +Data +==== +game.properties: +---- +enemies=aliens +lives=3 +enemies.cheat=true +enemies.cheat.level=noGoodRotten +secret.code.passphrase=UUDDLRLRBABAS +secret.code.allowed=true +secret.code.lives=30 +Events: +``` + +Perlu diingat baha nama dari ConfigMap yang dihasilkan memiliki sufiks yang ditambahkan dengan melakukan _hashing_ terhadap konten dari ConfigMap tersebut. Hal ini memastikan bahwa +sebuah ConfigMap baru akan dihasilkan setiap kali konten dimodifikasi. + +#### Menentukan kunci yang akan digunakan ketika generating ConfigMap dari sebuah berkas +Kamu dapat menentukan kunci selain nama berkas untuk digunakan pada generator ConfigMap. +Sebagai contoh, untuk menghasilkan sebuah ConfigMap dari berkas `configure-pod-container/configmap/game.properties` +dengan kunci `game-special-key` + +```shell +# Membuat berkas kustomization.yaml dengan ConfigMapGenerator +cat <./kustomization.yaml +configMapGenerator: +- name: game-config-5 + files: + - game-special-key=configure-pod-container/configmap/game.properties +EOF +``` + +Gunakan direktori kustomization untuk membuat objek ConfigMap. +```shell +kubectl apply -k . +configmap/game-config-5-m67dt67794 created +``` + +#### Menghasilkan ConfigMap dari Nilai-nilai Harfiah +Untuk menghasilkan ConfigMap dari nilai-nilai harfiah `special.type=charm` dan `special.how=very`, +kamu dapat menentukan generator ConfigMap pada `kustomization.yaml` sebagai berikut +```shell +# Membuat berkas kustomization.yaml dengan ConfigMapGenerator +cat <./kustomization.yaml +configMapGenerator: +- name: special-config-2 + literals: + - special.how=very + - special.type=charm +EOF +``` +Gunakan direktori kustomization untuk membuat objek ConfigMap. +```shell +kubectl apply -k . +configmap/special-config-2-c92b5mmcf2 created +``` + +## Menentukan variabel _environment_ kontainer menggunakan data ConfigMap + +### Menentukan variabel _environment_ kontainer dengan data dari sebuah ConfigMap + +1. Menentukan sebuah variabel _environment_ sebagai sepasang kunci-nilai pada ConfigMap: + + ```shell + kubectl create configmap special-config --from-literal=special.how=very + ``` + +2. Memberikan nilai `special.how` yang sudah terdapat pada ConfigMap pada variabel _environment_ `SPECIAL_LEVEL_KEY` di spesifikasi Pod. + + {{< codenew file="pods/pod-single-configmap-env-variable.yaml" >}} + + Buat Pod: + + ```shell + kubectl create -f https://kubernetes.io/id/examples/pods/pod-single-configmap-env-variable.yaml + ``` + + Sekarang, keluaran dari Pod meliputi variabel _environment_ `SPECIAL_LEVEL_KEY=very`. + +### Menentukan variabel _environment_ kontainer dengan data dari beberapa ConfigMap + + * Seperti pada contoh sebelumnya, buat ConfigMap terlebih dahulu. + + {{< codenew file="configmap/configmaps.yaml" >}} + + Buat ConfigMap: + + ```shell + kubectl create -f https://kubernetes.io/examples/configmap/configmaps.yaml + ``` + +* Tentukan variabel _environment_ pada spesifikasi Pod. + + {{< codenew file="pods/pod-multiple-configmap-env-variable.yaml" >}} + + Buat Pod: + + ```shell + kubectl create -f https://kubernetes.io/id/examples/pods/pod-multiple-configmap-env-variable.yaml + ``` + + Sekarang, keluaran Pod meliputi variabel _environment_ `SPECIAL_LEVEL_KEY=very` dan `LOG_LEVEL=INFO`. + +## Mengatur semua pasangan kunci-nilai pada ConfigMap sebagai variabel _environment_ kontainer + +{{< note >}} +Fungsi ini tersedia pada Kubernetes v1.6 dan selanjutnya. +{{< /note >}} + +* Buat ConfigMap yang berisi beberapa pasangan kunci-nilai. + + {{< codenew file="configmap/configmap-multikeys.yaml" >}} + + Buat ConfigMap: + + ```shell + kubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml + ``` + +* Gunakan `envFrom` untuk menentukan seluruh data pada ConfigMap sebagai variabel _environment_ kontainer. Kunci dari ConfigMap akan menjadi nama variabel _environment_ di dalam Pod. + + {{< codenew file="pods/pod-configmap-envFrom.yaml" >}} + + Buat Pod: + + ```shell + kubectl create -f https://kubernetes.io/examples/pods/pod-configmap-envFrom.yaml + ``` + + Sekarang, Pod keluaran pod meliputi variabel _environment_ `SPECIAL_LEVEL=very` dan `SPECIAL_TYPE=charm`. + + +## Menggunakan variabel _environment_ yang ditentukan ConfigMap pada perintah Pod + +Kamu dapat menggunakan variabel _environment_ yang ditentukan ConfigMap pada bagian `command` dari spesifikasi Pod menggunakan sintaks substitusi Kubernetes `$(VAR_NAME)`. + +Sebagai contoh, spesifikasi Pod berikut + +{{< codenew file="pods/pod-configmap-env-var-valueFrom.yaml" >}} + +dibuat dengan menjalankan + +```shell +kubectl create -f https://kubernetes.io/examples/pods/pod-configmap-env-var-valueFrom.yaml +``` + +menghasilkan keluaran pada kontainer `test-container` seperti berikut: + +```shell +very charm +``` + +## Menambahkan data ConfigMap pada Volume + +Seperti yang sudah dijelaskan pada [Membuat ConfigMap dari berkas](#membuat-configmap-dari-berkas), ketika kamu membuat ConfigMap menggunakan ``--from-file``, nama dari berkas tersebut akan menjadi kunci yang disimpan pada bagian `data` dari ConfigMap. Isi berkas tersebut akan menjadi nilai dari kunci tersebut. + +Contoh pada bagian ini merujuk pada ConfigMap bernama `special-config`, Seperti berikut. + +{{< codenew file="configmap/configmap-multikeys.yaml" >}} + +Buat ConfigMap: + +```shell +kubectl create -f https://kubernetes.io/examples/configmap/configmap-multikeys.yaml +``` + +### Mengisi Volume dengan data yang disimpan Pada ConfigMap + +Tambahkan nama ConfigMap di bawah bagian `volumes` pada spesifikasi Pod. +Hal ini akan menambahkan data ConfigMap pada direktori yang ditentukan oleh `volumeMounts.mountPath` (pada kasus ini, `/etc/config`). +Bagian `command` berisi daftar berkas pada direktori dengan nama-nama yang sesuai dengan kunci-kunci pada ConfigMap. + +{{< codenew file="pods/pod-configmap-volume.yaml" >}} + +Buat Pod: + +```shell +kubectl create -f https://kubernetes.io/i/examples/pods/pod-configmap-volume.yaml +``` + +Ketika Pod berjalan, perintah `ls /etc/config/` akan menghasilkan keluaran di bawah: + +```shell +SPECIAL_LEVEL +SPECIAL_TYPE +``` + +{{< caution >}} +Jika ada beberapa berkas pada direktori `/etc/config/`, berkas-berkas tersebut akan dihapus. +{{< /caution >}} + +### Menambahkan data ConfigMap pada jalur tertentu pada Volume + +Gunakan kolom `path` untuk menentukan jalur berkas yang diinginkan untuk butir tertentu pada ConfigMap (butir ConfigMap tertentu). +Pada kasus ini, butir `SPECIAL_LEVEL` akan akan dipasangkan sebagai `config-volume` pada `/etc/config/keys`. + +{{< codenew file="pods/pod-configmap-volume-specific-key.yaml" >}} + +Buat Pod: + +```shell +kubectl create -f https://kubernetes.io/examples/pods/pod-configmap-volume-specific-key.yaml +``` + +Ketika Pod berjalan, perintah `cat /etc/config/keys` akan menghasilkan keluaran di bawah: + +```shell +very +``` + +{{< caution >}} +Seperti sebelumnya, semua berkas yang sebelumnya berada pada direktori `/etc/config/` akan dihapus. +{{< /caution >}} + +### Memproyeksikan kunci ke jalur dan perizinan berkas tertentu + +Kamu dapat memproyeksikan kunci ke jalur dan perizinan tertentu pada setiap +berkas. Panduan pengguna [Secret](/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod) menjelaskan mengenai sintaks-sintaksnya. + +### ConfigMap yang dipasang akan diperbarui secara otomatis + +Ketika sebuah ConfigMap yang sudah dipasang pada sebuah volume diperbarui, kunci-kunci yang diproyeksikan akan turut diperbarui. Kubelet akan memeriksa apakah ConfigMap yang dipasang merupakan yang terbaru pada sinkronisasi berkala. Namun, ConfigMap menggunakan _cache_ lokal berbasis ttl (_time-to-live_) miliknya untuk mendapatkan nilai dari ConfigMap saat ini. Hasilnya, keseluruhan penundaan dari saat ketika ConfigMap diperbarui sampai saat ketika kunci-kunci baru diproyeksikan ke pada Pod bisa selama periode sinkronisasi kubelet (secara bawaan selama 1 menit) + ttl dari _cache_ ConfigMap (secara bawaan selama 1 menit) pada kubelet. Kamu dapat memicu pembaruan langsung dengan memperbarui salah satu dari anotasi Pod. + +{{< note >}} +Kontainer yang menggunakan ConfigMap sebagai volume [subPath](/docs/concepts/storage/volumes/#using-subpath) tidak akan menerima pembaruan ConfigMap. +{{< /note >}} + +{{% /capture %}} + +{{% capture discussion %}} + +## Memahami ConfigMap dan Pod + +Sumber daya API ConfigMap menyimpan data konfigurasi sebagai pasangan kunci-nilai. Data tersebut dapat dikonsumsi oleh Pod atau sebagai penyedia konfigurasi untuk komponen-komponen sistem seperti kontroler. ConfigMap mirip dengan [Secret](/docs/concepts/configuration/secret/), tetapi ConfigMap dimaksudkan untuk mengolah tulisan yang tidak memiliki informasi yang sensitif. Baik pengguna maupun komponen sistem dapat menyimpan data konfigurasi pada ConfigMap. + +{{< note >}} +ConfigMap harus mereferensikan berkas-berkas properti, bukan menggantikannya. Anggaplah ConfigMap sebagai sesuatu yang merepresentasikan direktori `/etc` beserta isinya pada Linux. Sebagai contoh, jika kamu membuat sebuah [Volume Kubernetes](/docs/concepts/storage/volumes/) dari ConfigMap, tiap butir data pada ConfigMap direpresentasikan sebagai sebuah berkas pada volume. +{{< /note >}} + +Kolom `data` pada ConfigMap berisi data konfigurasi. Seperti pada contoh di bawah, hal ini bisa berupa sesuatu yang sederhana -- seperti properti individual yang ditentukan menggunakan `--from-literal` -- atau sesuatu yang kompleks -- seperti berkas konfigurasi atau _blob_ JSON yang ditentukan dengan `--from-file`. + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + creationTimestamp: 2016-02-18T19:14:38Z + name: example-config + namespace: default +data: + # contoh properti yang sederhana yang ditentukan menggunakan --from-literal + example.property.1: hello + example.property.2: world + # contoh properti yang kompleks yang ditentukan menggunakan --from-file + example.property.file: |- + property.1=value-1 + property.2=value-2 + property.3=value-3 +``` + +### Batasan + +- Kamu harus membuat ConfigMap sebelum merujuknya pada spesifikasi Pod (kecuali kamu menandai ConfigMap sebagai "_optional_"). Jika kamu merujuk sebuah ConfigMap yang tidak ada, Pod tersebut tidak akan berjalan. Sama halnya, mereferensikan kunci yang tidak ada pada ConfigMap akan mencegah Pod untuk berjalan. + +- Jika kamu menggunakan `envFrom` untuk menentukan variabel _environment_ dari ConfigMap, kunci-kunci yang dianggap tidak sah akan dilewat. Pod akan diizinkan untuk berjalan, tetapi nama-nama yang tidak sah akan direkam pada _event log_ (`InvalidVariableNames`). Pesan _log_ tersebut mencantumkan tiap kunci yang dilewat. Sebagai contoh: + + ```shell + kubectl get events + ``` + + Keluaran akan tampil seperti berikut: + ``` + LASTSEEN FIRSTSEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE + 0s 0s 1 dapi-test-pod Pod Warning InvalidEnvironmentVariableNames {kubelet, 127.0.0.1} Keys [1badkey, 2alsobad] from the EnvFrom configMap default/myconfig were skipped since they are considered invalid environment variable names. + ``` + +- ConfigMap berada pada {{< glossary_tooltip term_id="namespace" >}} tertentu. ConfigMap hanya dapat dirujuk oleh Pod yang berada pada Namespace yang sama. + +- Kamu tidak dapat menggunakan ConfigMap untuk {{< glossary_tooltip text="Pod statis" term_id="static-pod" >}}, karena Kubelet tidak mendukung hal ini. + +{{% /capture %}} + +{{% capture whatsnext %}} +* Ikuti contoh penerapan pada dunia nyata [Mengatur Redis menggunakan ConfigMap](/docs/tutorials/configuration/configure-redis-using-configmap/). + +{{% /capture %}} diff --git a/content/id/examples/configmap/configmap-multikeys.yaml b/content/id/examples/configmap/configmap-multikeys.yaml new file mode 100644 index 0000000000..289702d123 --- /dev/null +++ b/content/id/examples/configmap/configmap-multikeys.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: special-config + namespace: default +data: + SPECIAL_LEVEL: very + SPECIAL_TYPE: charm diff --git a/content/id/examples/configmap/configmaps.yaml b/content/id/examples/configmap/configmaps.yaml new file mode 100644 index 0000000000..91b9f29755 --- /dev/null +++ b/content/id/examples/configmap/configmaps.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: special-config + namespace: default +data: + special.how: very +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: env-config + namespace: default +data: + log_level: INFO diff --git a/content/id/examples/pods/pod-configmap-env-var-valueFrom.yaml b/content/id/examples/pods/pod-configmap-env-var-valueFrom.yaml new file mode 100644 index 0000000000..a72b4335ce --- /dev/null +++ b/content/id/examples/pods/pod-configmap-env-var-valueFrom.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dapi-test-pod +spec: + containers: + - name: test-container + image: k8s.gcr.io/busybox + command: [ "/bin/sh", "-c", "echo $(SPECIAL_LEVEL_KEY) $(SPECIAL_TYPE_KEY)" ] + env: + - name: SPECIAL_LEVEL_KEY + valueFrom: + configMapKeyRef: + name: special-config + key: SPECIAL_LEVEL + - name: SPECIAL_TYPE_KEY + valueFrom: + configMapKeyRef: + name: special-config + key: SPECIAL_TYPE + restartPolicy: Never diff --git a/content/id/examples/pods/pod-configmap-envFrom.yaml b/content/id/examples/pods/pod-configmap-envFrom.yaml new file mode 100644 index 0000000000..70ae7e5bcf --- /dev/null +++ b/content/id/examples/pods/pod-configmap-envFrom.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dapi-test-pod +spec: + containers: + - name: test-container + image: k8s.gcr.io/busybox + command: [ "/bin/sh", "-c", "env" ] + envFrom: + - configMapRef: + name: special-config + restartPolicy: Never diff --git a/content/id/examples/pods/pod-configmap-volume-specific-key.yaml b/content/id/examples/pods/pod-configmap-volume-specific-key.yaml new file mode 100644 index 0000000000..72e38fd836 --- /dev/null +++ b/content/id/examples/pods/pod-configmap-volume-specific-key.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dapi-test-pod +spec: + containers: + - name: test-container + image: k8s.gcr.io/busybox + command: [ "/bin/sh","-c","cat /etc/config/keys" ] + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + name: special-config + items: + - key: SPECIAL_LEVEL + path: keys + restartPolicy: Never diff --git a/content/id/examples/pods/pod-configmap-volume.yaml b/content/id/examples/pods/pod-configmap-volume.yaml new file mode 100644 index 0000000000..16457e63c4 --- /dev/null +++ b/content/id/examples/pods/pod-configmap-volume.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dapi-test-pod +spec: + containers: + - name: test-container + image: k8s.gcr.io/busybox + command: [ "/bin/sh", "-c", "ls /etc/config/" ] + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + # Berikan nama dari ConfigMap yang berisi berkas-berkas yang ingin kamu + # tambahkan ke kontainer + name: special-config + restartPolicy: Never diff --git a/content/id/examples/pods/pod-multiple-configmap-env-variable.yaml b/content/id/examples/pods/pod-multiple-configmap-env-variable.yaml new file mode 100644 index 0000000000..4790a9c661 --- /dev/null +++ b/content/id/examples/pods/pod-multiple-configmap-env-variable.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dapi-test-pod +spec: + containers: + - name: test-container + image: k8s.gcr.io/busybox + command: [ "/bin/sh", "-c", "env" ] + env: + - name: SPECIAL_LEVEL_KEY + valueFrom: + configMapKeyRef: + name: special-config + key: special.how + - name: LOG_LEVEL + valueFrom: + configMapKeyRef: + name: env-config + key: log_level + restartPolicy: Never diff --git a/content/id/examples/pods/pod-single-configmap-env-variable.yaml b/content/id/examples/pods/pod-single-configmap-env-variable.yaml new file mode 100644 index 0000000000..c2aacd2de0 --- /dev/null +++ b/content/id/examples/pods/pod-single-configmap-env-variable.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: dapi-test-pod +spec: + containers: + - name: test-container + image: k8s.gcr.io/busybox + command: [ "/bin/sh", "-c", "env" ] + env: + # Tentukan variabel environment + - name: SPECIAL_LEVEL_KEY + valueFrom: + configMapKeyRef: + # ConfigMap berisi nilai yang ingin kamu berikan pada SPECIAL_LEVEL_KEY + name: special-config + # Tentukan kunci yang diasosiasikan dengan nilainya + key: special.how + restartPolicy: Never From 5f88e973bde28a697bef86e9451cce24ef07ce66 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Thu, 7 May 2020 19:43:27 +0300 Subject: [PATCH 38/67] Translate Learn Kubernetes Basics into Russian --- content/ru/docs/_index.md | 71 +-------- content/ru/docs/tutorials/_index.md | 70 +++++++++ .../tutorials/kubernetes-basics/_index.html | 116 ++++++++++++++ .../create-cluster/_index.md | 4 + .../create-cluster/cluster-interactive.html | 37 +++++ .../create-cluster/cluster-intro.html | 106 +++++++++++++ .../kubernetes-basics/deploy-app/_index.md | 4 + .../deploy-app/deploy-interactive.html | 49 ++++++ .../deploy-app/deploy-intro.html | 104 +++++++++++++ .../kubernetes-basics/explore/_index.md | 4 + .../explore/explore-interactive.html | 41 +++++ .../explore/explore-intro.html | 145 ++++++++++++++++++ .../kubernetes-basics/expose/_index.md | 4 + .../expose/expose-interactive.html | 38 +++++ .../expose/expose-intro.html | 108 +++++++++++++ .../kubernetes-basics/scale/_index.md | 4 + .../scale/scale-interactive.html | 40 +++++ .../kubernetes-basics/scale/scale-intro.html | 120 +++++++++++++++ .../kubernetes-basics/update/_index.md | 4 + .../update/update-interactive.html | 37 +++++ .../update/update-intro.html | 135 ++++++++++++++++ 21 files changed, 1172 insertions(+), 69 deletions(-) create mode 100644 content/ru/docs/tutorials/_index.md create mode 100644 content/ru/docs/tutorials/kubernetes-basics/_index.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/create-cluster/_index.md create mode 100644 content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/deploy-app/_index.md create mode 100644 content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-interactive.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/explore/_index.md create mode 100644 content/ru/docs/tutorials/kubernetes-basics/explore/explore-interactive.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/explore/explore-intro.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/expose/_index.md create mode 100644 content/ru/docs/tutorials/kubernetes-basics/expose/expose-interactive.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/expose/expose-intro.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/scale/_index.md create mode 100644 content/ru/docs/tutorials/kubernetes-basics/scale/scale-interactive.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/scale/scale-intro.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/update/_index.md create mode 100644 content/ru/docs/tutorials/kubernetes-basics/update/update-interactive.html create mode 100644 content/ru/docs/tutorials/kubernetes-basics/update/update-intro.html diff --git a/content/ru/docs/_index.md b/content/ru/docs/_index.md index b79c7c822f..09f6d57a37 100644 --- a/content/ru/docs/_index.md +++ b/content/ru/docs/_index.md @@ -1,70 +1,3 @@ - --- -title: Руководства -main_menu: true -weight: 60 -content_template: templates/concept --- - -{{% capture overview %}} - -В данном разделе документации Kubernetes можно найти руководства. В них рассказывается, как достичь определённой цели, а не просто выполнить одно задачу (/docs/tasks/). Большинство уроков состоит из нескольких разделов, каждый из которых включает в себя шаги для последовательного выполнения. Перед тем как приступить к выполнению уроков, может быть полезно ознакомиться со [словарем терминов](/docs/reference/glossary/) для последующих обращений. - -{{% /capture %}} - -{{% capture body %}} - -## Основы - -* [Основы Kubernetes](/docs/tutorials/kubernetes-basics/) - глубокое интерактивное руководство, направленное на понимание системы и предлагающее попробовать некоторые основные возможности Kubernetes. - -* [Масштабируемые микросервисы с Kubernetes (Udacity)](https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615) - -* [Введение в Kubernetes (edX)](https://www.edx.org/course/introduction-kubernetes-linuxfoundationx-lfs158x#) - -* [Hello Minikube](/docs/tutorials/hello-minikube/) - -## Конфигурирование - -* [Конфигурирование Redis с использованием ConfigMap](/docs/tutorials/configuration/configure-redis-using-configmap/) - -## Stateless приложения - -* [Установка внешнего IP адреса для получения доступа к приложению в кластере](/docs/tutorials/stateless-application/expose-external-ip-address/) - -* [Пример: развёртывание приложения "Гостевая книга" на PHP с использованием Redis](/docs/tutorials/stateless-application/guestbook/) - -## Stateful приложения - -* [Основы StatefulSet](/docs/tutorials/stateful-application/basic-stateful-set/) - -* [Пример: WordPress и MySQL с персистентным хранилищем](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/) - -* [Пример: Развёртывание Cassandra с Stateful Sets](/docs/tutorials/stateful-application/cassandra/) - -* [Запуск ZooKeeper, A CP Distributed System](/docs/tutorials/stateful-application/zookeeper/) - -## CI/CD пайплайн - -* [Настройка CI/CD пайплайна с Kubernetes Часть 1: Обзор](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/5/set-cicd-pipeline-kubernetes-part-1-overview) - -* [Настройка CI/CD пайплайна с подом Jenkins в Kubernetes (Часть 2)](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/6/set-cicd-pipeline-jenkins-pod-kubernetes-part-2) - -* [Запуск и масштабирование приложения распределённого кроссворда с CI/CD в Kubernetes (Часть 3)](https://www.linux.com/blog/learn/chapter/intro-to-kubernetes/2017/6/run-and-scale-distributed-crossword-puzzle-app-cicd-kubernetes-part-3) - -* [Настройка CI/CD для приложения распределённого кроссворда в Kubernetes (Часть 4)](https://www.linux.com/blog/learn/chapter/intro-to-kubernetes/2017/6/set-cicd-distributed-crossword-puzzle-app-kubernetes-part-4) - -## Clusters - -* [AppArmor](/docs/tutorials/clusters/apparmor/) - -## Services - -* [Использование IP](/docs/tutorials/services/source-ip/) - -{{% /capture %}} - -{{% capture whatsnext %}} - -Если вы хотите создать руководство самостоятельно, обратитесь к странице [Использование шаблонов страниц](/docs/home/contribute/page-templates/), чтобы узнать информацию и посмотреть шаблоны для составления руководств. - -{{% /capture %}} +title: Документация +--- diff --git a/content/ru/docs/tutorials/_index.md b/content/ru/docs/tutorials/_index.md new file mode 100644 index 0000000000..b79c7c822f --- /dev/null +++ b/content/ru/docs/tutorials/_index.md @@ -0,0 +1,70 @@ + --- +title: Руководства +main_menu: true +weight: 60 +content_template: templates/concept +--- + +{{% capture overview %}} + +В данном разделе документации Kubernetes можно найти руководства. В них рассказывается, как достичь определённой цели, а не просто выполнить одно задачу (/docs/tasks/). Большинство уроков состоит из нескольких разделов, каждый из которых включает в себя шаги для последовательного выполнения. Перед тем как приступить к выполнению уроков, может быть полезно ознакомиться со [словарем терминов](/docs/reference/glossary/) для последующих обращений. + +{{% /capture %}} + +{{% capture body %}} + +## Основы + +* [Основы Kubernetes](/docs/tutorials/kubernetes-basics/) - глубокое интерактивное руководство, направленное на понимание системы и предлагающее попробовать некоторые основные возможности Kubernetes. + +* [Масштабируемые микросервисы с Kubernetes (Udacity)](https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615) + +* [Введение в Kubernetes (edX)](https://www.edx.org/course/introduction-kubernetes-linuxfoundationx-lfs158x#) + +* [Hello Minikube](/docs/tutorials/hello-minikube/) + +## Конфигурирование + +* [Конфигурирование Redis с использованием ConfigMap](/docs/tutorials/configuration/configure-redis-using-configmap/) + +## Stateless приложения + +* [Установка внешнего IP адреса для получения доступа к приложению в кластере](/docs/tutorials/stateless-application/expose-external-ip-address/) + +* [Пример: развёртывание приложения "Гостевая книга" на PHP с использованием Redis](/docs/tutorials/stateless-application/guestbook/) + +## Stateful приложения + +* [Основы StatefulSet](/docs/tutorials/stateful-application/basic-stateful-set/) + +* [Пример: WordPress и MySQL с персистентным хранилищем](/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/) + +* [Пример: Развёртывание Cassandra с Stateful Sets](/docs/tutorials/stateful-application/cassandra/) + +* [Запуск ZooKeeper, A CP Distributed System](/docs/tutorials/stateful-application/zookeeper/) + +## CI/CD пайплайн + +* [Настройка CI/CD пайплайна с Kubernetes Часть 1: Обзор](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/5/set-cicd-pipeline-kubernetes-part-1-overview) + +* [Настройка CI/CD пайплайна с подом Jenkins в Kubernetes (Часть 2)](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/6/set-cicd-pipeline-jenkins-pod-kubernetes-part-2) + +* [Запуск и масштабирование приложения распределённого кроссворда с CI/CD в Kubernetes (Часть 3)](https://www.linux.com/blog/learn/chapter/intro-to-kubernetes/2017/6/run-and-scale-distributed-crossword-puzzle-app-cicd-kubernetes-part-3) + +* [Настройка CI/CD для приложения распределённого кроссворда в Kubernetes (Часть 4)](https://www.linux.com/blog/learn/chapter/intro-to-kubernetes/2017/6/set-cicd-distributed-crossword-puzzle-app-kubernetes-part-4) + +## Clusters + +* [AppArmor](/docs/tutorials/clusters/apparmor/) + +## Services + +* [Использование IP](/docs/tutorials/services/source-ip/) + +{{% /capture %}} + +{{% capture whatsnext %}} + +Если вы хотите создать руководство самостоятельно, обратитесь к странице [Использование шаблонов страниц](/docs/home/contribute/page-templates/), чтобы узнать информацию и посмотреть шаблоны для составления руководств. + +{{% /capture %}} diff --git a/content/ru/docs/tutorials/kubernetes-basics/_index.html b/content/ru/docs/tutorials/kubernetes-basics/_index.html new file mode 100644 index 0000000000..e6548931c3 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/_index.html @@ -0,0 +1,116 @@ +--- +title: Основы Kubernetes +linkTitle: Основы Kubernetes +weight: 10 +card: + name: tutorials + weight: 20 + title: Краткий обзор основ +--- + + + + + + + + + +

+ +
+ +
+
+

Основы Kubernetes

+

В данном руководстве вы познакомитесь с основами системы оркестрации кластеров Kubernetes. Каждый модуль содержит краткую справочную информацию по основной функциональности и концепциям Kubernetes, а также включает интерактивные онлайн-уроки. С их помощью вы научитесь самостоятельно управлять простым кластером и контейнеризированными приложениями, которые были в нём развернуты.

+

Пройдя интерактивные уроки, вы узнаете, как:

+
    +
  • развёртывать контейнеризированное приложение в кластер.
  • +
  • масштабировать развёртывание.
  • +
  • обновить контейнеризированное приложение на новую версию ПО.
  • +
  • отлаживать контейнеризированное приложение.
  • +
+

Все руководства используют сервис Katacoda, поэтому в вашем браузере будет показан виртуальный терминал с работающим Minikube, небольшой локальной средой Kubernetes, которая может работать где угодно. Вам не потребуется устанавливать дополнительное ПО или вообще что-либо настраивать. Каждый интерактивный урок запускается непосредственно в вашем браузере.

+
+
+ +
+ +
+
+

Чем может Kubernetes помочь вам?

+

От современных веб-сервисов пользователи ожидают, что приложения будут доступны 24/7, а разработчики — развёртывать новые версии приложений по нескольку раз в день. Контейнеризация направлена на достижение этой цели, упаковывая ПО и позволяя выпускать и обновлять приложения просто, быстро и без простоев. Kubernetes гарантирует вам, что ваши контейнеризованные приложения будет запущены где угодно и когда угодно, вместе со всеми необходимыми для их работы ресурсами и инструментами. Kubernetes — это готовая к промышленному использованию платформа с открытым исходным кодом, разработанная исходя из накопленного опыта Google по оркестровке контейнеров и лучшими идеями от сообщества.

+
+
+ +
+ + + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/create-cluster/_index.md b/content/ru/docs/tutorials/kubernetes-basics/create-cluster/_index.md new file mode 100644 index 0000000000..7a44a6372d --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/create-cluster/_index.md @@ -0,0 +1,4 @@ +--- +title: Создание кластера +weight: 10 +--- diff --git a/content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive.html b/content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive.html new file mode 100644 index 0000000000..a473d280d3 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive.html @@ -0,0 +1,37 @@ +--- +title: Интерактивный урок - Создание кластера +weight: 20 +--- + + + + + + + + + + + +
+ +
+ +
+
+ Данный экран слишком маленький, чтобы работать с терминалом, пожалуйста, используйте компьютер или планшет. +
+
+
+ + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro.html b/content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro.html new file mode 100644 index 0000000000..9d2ebad3c2 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro.html @@ -0,0 +1,106 @@ +--- +title: Использование Minikube для создания кластера +weight: 10 +--- + + + + + + + + + +
+ +
+ +
+ +
+

Темы

+
    +
  • Узнать, что такое кластер Kubernetes.
  • +
  • Узнать, что такое Minikube.
  • +
  • Запуск кластера Kubernetes через онлайн-терминал.
  • +
+
+ +
+

Кластеры Kubernetes

+

+ Задача Kubernetes заключается в координации кластера компьютеров, работающего как одно целое. Абстрактные объекты в Kubernetes позволяют развертывать контейнеризированные приложения в кластер, не привязывая их к отдельным машинам. Для использования этой новой модели развертывания, приложения должны быть подготовлены так, чтобы они не зависели от конкретных хостов, т.е. они должны быть упакованы в контейнеры. Приложения в контейнерах более гибки и доступны, чем в предыдущих моделях развертывания, когда приложения устанавливались непосредственно на конкретные машины в виде пакетов, тесно связанных с хостом. Kubernetes автоматизирует распределение и выполнение контейнеров приложений для запуска в кластере более эффективным образом. Kubernetes — это платформа с открытым исходным кодом, готовая к промышленной эксплуатации. +

+

Кластер Kubernetes состоит из двух типов ресурса: +

    +
  • Мастер (ведущий узел) управляет кластером
  • +
  • Рабочие узлы — машины, на которых выполняются приложения
  • +
+

+
+ +
+
+

Краткое содержание:

+
    +
  • Кластер Kubernetes
  • +
  • Minikube
  • +
+
+
+

+ Kubernetes — платформа с открытым исходным кодом промышленного уровня, которая управляет размещением (планированием) и запуском контейнеров приложений в пределах компьютерных кластеров и между ними. +

+
+
+
+
+ +
+
+

Схема кластера

+
+
+ +
+
+

+
+
+
+ +
+
+

Мастер отвечает за управление кластером. Мастер координирует все процессы в кластере, такие как планирование выполнения приложений, сохранение требуемого состояния приложений, а также их масштабирование и обновление.

+

Узел — это виртуальная машина или физический компьютер, который выполняет роль рабочего узла в кластере Kubernetes. У каждого узла есть Kubelet — агент, управляющий узлом и взаимодействующий с ведущим узлом Kubernetes. Узел также имеет инструменты для выполнения контейнерных операций, например, Docker или rkt. Кластер Kubernetes в промышленном окружении должен состоять как минимум из трёх узлов.

+
+
+
+

Ведущие узлы управляют кластером и узлами, которые используются для запуска приложений.

+
+
+
+ +
+
+

При развертывании приложений в Kubernetes вы сообщаете ведущему узлу запускать контейнеры приложений. Ведущий узел планирует выполнение контейнеров на узлах кластера. Узлы взаимодействуют с ведущим узлом посредством API Kubernetes, который предлагает ведущий узел. Кроме этого, конечные пользователи могут напрямую использовать API Kubernetes для работы с кластером.

+ +

Kubernetes-кластер может быть развернут на физических или виртуальных машинах. Чтобы начать работать с Kubernetes, можно использовать Minikube. Minikube — это упрощённая реализация Kubernetes, которая создает виртуальную машину на вашем локальном компьютере и разворачивает простой кластер с одним узлом. Minikube доступен для Linux, macOS и Windows. В CLI-инструменте Minikube есть основные операции для инициализации кластера, включая запуск, завершение, просмотра состояния и удаления кластера. Однако в этом уроке вы будете использовать онлайн-терминал с уже установленным Minikube.

+ +

Теперь, когда вы знаете, что такое Kubernetes, можно перейти к онлайн-уроку, где вы запустите ваш первый кластер!

+
+
+
+ + + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/deploy-app/_index.md b/content/ru/docs/tutorials/kubernetes-basics/deploy-app/_index.md new file mode 100644 index 0000000000..b019fae72c --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/deploy-app/_index.md @@ -0,0 +1,4 @@ +--- +title: Развёртывание приложения +weight: 20 +--- diff --git a/content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-interactive.html b/content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-interactive.html new file mode 100644 index 0000000000..f95fd9537b --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-interactive.html @@ -0,0 +1,49 @@ +--- +title: Интерактивный урок - Развёртывание приложения +weight: 20 +--- + + + + + + + + + + + +
+ +
+ +
+
+

+ Под — основной ресурс приложения Kubernetes. Каждый под представляет собой часть рабочей нагрузки, выполняемой в кластере. Узнать подробнее про поды. +

+
+
+ +
+
+
+ Для работы с терминалом, пожалуйста, используйте компьютер или планшет. +
+ +
+
+ +
+ + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro.html b/content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro.html new file mode 100644 index 0000000000..502beb23bd --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro.html @@ -0,0 +1,104 @@ +--- +title: Использование kubectl для развёртывания приложения +weight: 10 +--- + + + + + + + + + +
+ +
+ +
+ +
+

Темы

+
    +
  • Узнать про развёртывания приложения.
  • +
  • Развернуть первое приложение на Kubernetes с помощью kubectl.
  • +
+
+ +
+

Развёртывания Kubernetes

+ +

Как только вы запустили кластер Kubernetes, вы можете развернуть свои контейнеризированные приложения в него. Для этого вам нужно создать конфигурацию развёртывания (Deployment) в Kubernetes. Развёртывание сообщает Kubernetes, как создавать и обновлять экземпляры вашего приложения. После создания развёртывания ведущий узел Kubernetes планирует запустить экземпляры приложения на отдельных узлах в кластере.

+ +

Когда экземпляры приложения были созданы, контроллер развёртывания Kubernetes непрерывно отслеживает их. Если узел, на котором размещен экземпляр, вышёл из строя или был удалён, контроллер развёртывания вместо этого экземпляра использует экземпляр на другом узле в кластере. Этот процесс представляет собой механизм самовосстановления, обеспечивающий работу кластера в случае возникновения аппаратных неисправностей либо технических работ. + +

До того, как появились системы оркестровки, для запуска приложений обычно использовались установочные скрипты, которые не перезапускались после сбоя компьютера. Создавая экземпляры приложений и поддерживая их работу на нескольких узлах, развёртывания Kubernetes коренным образом отличаются в плане управления приложениями.

+ +
+ +
+
+

Краткое содержание:

+
    +
  • Развёртывания
  • +
  • Kubectl
  • +
+
+
+

+ Развёртывание отвечает за создание и обновление экземпляров приложения +

+
+
+
+
+ +
+
+

Развёртывание вашего первого приложения на Kubernetes

+
+
+ +
+
+

+
+
+
+ +
+
+

Вы можете создавать и управлять развёртыванием через командный инструмент Kubernetes под названием Kubectl. Kubectl использует API Kubernetes для работы с кластером. В этом модуле вы узнаете про наиболее используемые команды Kubectl, необходимые для создания развёртываний, которые будут запускать приложения в кластере Kubernetes.

+ +

При создании развертывания нужно указать образ контейнера приложения и количество запущенных реплик. Впоследствии эти параметры можно изменить. В модулях 5 и 6 рассказывается про масштабирование и обновление развертываний.

+
+
+
+

Чтобы приложение запускалось в Kubernetes, оно должно быть упаковано в один из поддерживаемых форматов контейнеров

+
+
+
+ +
+
+

+ В качестве первого развёртывания будем использовать приложение на Node.js, упакованное в Docker-контейнер. Следуя инструкциям в руководстве "Привет, Minikube" вы сможете создать такое приложение Node.js и поместить его в контейнер. +

+ +

Теперь, когда познакомились с развёртываниями, можно начать онлайн-урок, где вы развернёте своё первое приложение!

+
+
+
+ + + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/explore/_index.md b/content/ru/docs/tutorials/kubernetes-basics/explore/_index.md new file mode 100644 index 0000000000..f130bd1a64 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/explore/_index.md @@ -0,0 +1,4 @@ +--- +title: Изучение приложения +weight: 30 +--- diff --git a/content/ru/docs/tutorials/kubernetes-basics/explore/explore-interactive.html b/content/ru/docs/tutorials/kubernetes-basics/explore/explore-interactive.html new file mode 100644 index 0000000000..b0c9e767cb --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/explore/explore-interactive.html @@ -0,0 +1,41 @@ +--- +title: Интерактивный урок - Изучение приложения +weight: 20 +--- + + + + + + + + + + + +
+ +
+ +
+
+ +
+ Для работы с терминалом, пожалуйста, используйте компьютер или планшет. +
+ +
+
+
+ + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/explore/explore-intro.html b/content/ru/docs/tutorials/kubernetes-basics/explore/explore-intro.html new file mode 100644 index 0000000000..e8ab3e1de2 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/explore/explore-intro.html @@ -0,0 +1,145 @@ +--- +title: Изучение подов и узлов +weight: 10 +--- + + + + + + + + + + +
+ +
+ +
+ +
+

Темы

+
    +
  • Узнать про поды Kubernetes.
  • +
  • Узнать про узлы Kubernetes.
  • +
  • Диагностика развёрнутых приложений.
  • +
+
+ +
+

Поды Kubernetes

+ +

После того, как вы создали развёртывание в модуле 2, Kubernetes создал под (Pod), в котором был размещён экземпляр вашего приложения. Под — это абстрактный объект Kubernetes, представляющий собой группу из одного или нескольких контейнеров приложения (например, Docker или rkt) и совместно используемых ресурсов для этих контейнеров. Ресурсами могут быть:

+
    +
  • Общее хранилище (тома)
  • +
  • Сеть (уникальный IP-адрес кластера)
  • +
  • Информация по выполнению каждого контейнера (версия образа контейнера или используемые номера портов)
  • +
+

Под представляет специфичный для приложения "логический хост" и может содержать разные контейнеры приложений, которые в общем и целом тесно связаны. Например, в поде может размещаться как контейнер с приложением на Node.js, так и другой контейнер, который использует данные от веб-сервера Node.js. Все контейнеры в поде имеют одни и те же IP-адрес и пространство порта, выполняющиеся в общем контексте на одном и том же узле.

+ +

Поды — неделимая единица в платформе Kubernetes. При создании развёртывания в Kubernetes, создаются поды с контейнерами внутри (в отличие от непосредственного создания контейнеров). Каждый Pod-объект связан с узлом, на котором он размещён, и остаётся там до окончания работы (согласно стратегии перезапуска) либо удаления. В случае неисправности узла такой же под будет распределён на другие доступные узлы в кластере.

+
+
+
+

Краткое содержание:

+
    +
  • Поды
  • +
  • Узлы
  • +
  • Основные команды Kubectl
  • +
+
+
+

+ Под — группа из одного или нескольких контейнеров приложений (например, Docker или rkt), включающая общие используемые хранилище (тома), IP-адрес и информацию по их запуску. +

+
+
+
+
+ +
+
+

Схема подов

+
+
+ +
+
+

+
+
+
+ +
+
+

Узлы

+ +

Под всегда работает в узле. Узел — это рабочая машина в Kubernetes, которая в зависимости от кластера может быть либо виртуальной, либо физической. Каждый узел управляется мастером (ведущим узлом). Узел может содержать несколько подов, которые мастер Kubernetes автоматически размещает на разные узлы кластера. Ведущий узел при автоматическом планировании (распределении подов по узлам) учитывает доступные ресурсы на каждом узле.

+ +

В каждом узле Kubernetes как минимум работает:

+
    +
  • Kubelet — процесс, отвечающий за взаимодействие между мастером Kubernetes и узлом; он управляет подами и запущенными контейнерами на рабочей машине.
  • +
  • Среда выполнения контейнера (например, Docker или rkt), отвечающая за получение (загрузку) образа контейнера из реестра, распаковку контейнера и запуск приложения.
  • +
+ +
+
+
+

Контейнеры должны запускаться вместе только в пределах одного пода, если они тесно связаны и должны совместно использовать ресурсы (например, диск)

+
+
+
+ +
+ +
+
+

Схема узла

+
+
+ +
+
+

+
+
+
+ +
+
+

Диагностика с помощью kubectl

+ +

В модуле 2 вы использовали инструмент командной строки Kubectl. В этом (третьем) модуле вы продолжите его использовать, но для получения информации о развернутых приложениях и окружениях, в которых они работают. Наиболее распространенные операции выполняются с использованием следующих команд kubectl:

+
    +
  • kubectl get — вывод списка ресурсов
  • +
  • kubectl describe — вывод подробной информации о ресурсе
  • +
  • kubectl logs — вывод логов контейнера в поде
  • +
  • kubectl exec — выполнение команды в контейнере пода
  • +
+ +

Перечисленные выше команды можно использовать, чтобы узнать, когда и где приложения были развернуты, их текущее состояние и конфигурацию.

+ +

Теперь, когда вы познакомились поближе с компонентами кластера и командами, давайте изучим приложение.

+ +
+
+
+

Узел — рабочая машина в Kubernetes, которая может быть как виртуальной, так и физической (в зависимости от используемого кластера). В одном узле могут быть запущены несколько подов

+
+
+
+
+ + + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/expose/_index.md b/content/ru/docs/tutorials/kubernetes-basics/expose/_index.md new file mode 100644 index 0000000000..18a340d330 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/expose/_index.md @@ -0,0 +1,4 @@ +--- +title: Открытие доступа к приложению +weight: 40 +--- diff --git a/content/ru/docs/tutorials/kubernetes-basics/expose/expose-interactive.html b/content/ru/docs/tutorials/kubernetes-basics/expose/expose-interactive.html new file mode 100644 index 0000000000..791d1a82e2 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/expose/expose-interactive.html @@ -0,0 +1,38 @@ +--- +title: Интерактивный урок - Открытие доступа к приложению +weight: 20 +--- + + + + + + + + + + + +
+ +
+ +
+
+ Для работы с терминалом, пожалуйста, используйте компьютер или планшет. +
+
+
+
+ + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/expose/expose-intro.html b/content/ru/docs/tutorials/kubernetes-basics/expose/expose-intro.html new file mode 100644 index 0000000000..3ef66070ff --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/expose/expose-intro.html @@ -0,0 +1,108 @@ +--- +title: Создание сервиса для открытия доступа к приложению +weight: 10 +--- + + + + + + + + + +
+ +
+ +
+
+

Темы

+
    +
  • Узнать о сервисах в Kubernetes
  • +
  • Разобраться с тем, как метки и объекты LabelSelector связаны с сервисом
  • +
  • Открыть доступ к приложению вне кластера Kubernetes через сервис
  • +
+
+ +
+

Обзор сервисов Kubernetes

+

Под — это расходный материал в Kubernetes. У подов есть жизненный цикл. Когда рабочий узел завершается, запущенные поды в узле также уничтожаются. После этого ReplicaSet попытается автоматически вернуть кластер обратно в требуемое состояние, создавая новые поды, чтобы поддержать работоспособность приложения. Другой пример — бэкенд для обработки изображений с 3 репликами. Поскольку это взаимозаменяемые реплики, то они не влияют на фронтенд-часть, даже если под был уничтожен и пересоздан. Тем не менее, каждый под в кластере Kubernetes имеет уникальный IP-адрес, даже под на одном и том же узле, поэтому должен быть способ автоматической координации изменений между подами, чтобы приложения продолжали функционировать.

+ +

Сервис в Kubernetes — это абстрактный объект, который определяет логический набор подов и политику доступа к ним. Сервисы создают слабую связь между подами, которые от них зависят. Сервис создаётся в формате YAML (рекомендуемый формат) или JSON, как и все остальные объекты в Kubernetes. Как правило, набор подов для сервиса определяется LabelSelector (ниже описано, в каких случаях понадобиться сервис без указания selector в спецификации).

+ +

Хотя у каждого пода есть уникальный IP-адрес, эти IP-адреса не доступны за пределами кластера без использования сервиса. Сервисы позволяют приложениям принимать трафик. Сервисы могут по-разному открыты, в зависимости от указанного поля type в ServiceSpec:

+
    +
  • ClusterIP (по умолчанию) - открывает доступ к сервису по внутреннему IP-адресу в кластере. Этот тип делает сервис доступным только внутри кластера.
  • +
  • NodePort - открывает сервис на одном и том же порту каждого выбранного узла в кластере с помощью NAT. Делает сервис доступным вне кластера, используя <NodeIP>:<NodePort>. Является надмножеством ClusterIP.
  • +
  • LoadBalancer - создает внешний балансировщик нагрузки в текущем облаке (если это поддерживается) и назначает фиксированный внешний IP-адрес для сервиса. Является надмножеством NodePort.
  • +
  • ExternalName - открывает доступ к сервису с указанным именем (определённое в поле externalName в спецификации) и возвращает запись CNAME. Прокси не используется. Для этого типа требуется версия kube-dns 1.7 или выше.
  • +
+

Более подробно узнать о различных типах сервисах можно в руководстве Использование IP-порта источника. Также изучите Подключение приложений к сервисам.

+

Кроме этого, обратите внимание, что в некоторых случаях в сервисах не определяется selector в спецификации. Сервис без selector не будет создавать соответствующий объект конечной точки (Endpoint). Таким образом, пользователь может вручную назначить сервис определённым конечным точкам. Использование type: ExternalName — это другой вариант использования, когда не нужно определять селектор в сервисе.

+
+
+
+

Краткое содержание

+
    +
  • Открытие внешнего трафика для подов
  • +
  • Балансировка нагрузки трафика между подов
  • +
  • Использование метки
  • +
+
+
+

Сервис Kubernetes — это уровень абстракции, который определяет логический набор подов, перенаправляет внешний трафик, балансирует нагрузку и реализует паттерн Service Discovery для этих подов.

+
+
+
+
+ +
+
+

Сервисы и метки

+
+
+ +
+
+

+
+
+ +
+
+

Сервис направляет трафик через набор подов. Сервисы — это абстракция, позволяющая взаимозаменять поды Kubernetes без ущерба для приложения. Сервисы в Kubernetes находят и маршрутизируют трафик между зависимыми подами (это могут быть фронтенд- и бэкенд-компоненты приложения).

+

Сервисы для выбора набора подов используют метки и селекторы. Метки — пары ключ-значение, добавленные к объектам; например, они могут использоваться чтобы:

+
    +
  • Идентифицировать объекты для окружений разработки, тестирования и продакшена
  • +
  • Добавить теги версии
  • +
  • Классифицировать объекты через теги
  • +
+
+ +
+ +
+ +
+
+

+
+
+
+
+
+

Метки могут добавляться во время создания объектов или после этого. Они также могут быть изменены в любое время. Теперь давайте откроем доступ к приложению путём создания сервиса и добавление меток.

+
+
+
+ +
+
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/scale/_index.md b/content/ru/docs/tutorials/kubernetes-basics/scale/_index.md new file mode 100644 index 0000000000..f6dcef7bc7 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/scale/_index.md @@ -0,0 +1,4 @@ +--- +title: Масштабирование приложения +weight: 50 +--- diff --git a/content/ru/docs/tutorials/kubernetes-basics/scale/scale-interactive.html b/content/ru/docs/tutorials/kubernetes-basics/scale/scale-interactive.html new file mode 100644 index 0000000000..e429b92118 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/scale/scale-interactive.html @@ -0,0 +1,40 @@ +--- +title: Интерактивный урок - Масштабирование приложения +weight: 20 +--- + + + + + + + + + + + +
+ +
+ +
+
+ Для работы с терминалом, пожалуйста, используйте компьютер или планшет +
+
+
+
+ + +
+ + + +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/scale/scale-intro.html b/content/ru/docs/tutorials/kubernetes-basics/scale/scale-intro.html new file mode 100644 index 0000000000..999c549db5 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/scale/scale-intro.html @@ -0,0 +1,120 @@ +--- +title: Запуск нескольких экземпляров приложения +weight: 10 +--- + + + + + + + + + +
+ +
+ +
+ +
+

Темы

+
    +
  • Масштабирование приложения с помощью kubectl.
  • +
+
+ +
+

Масштабирование приложения

+ +

В предыдущих модулях мы создали развёртывание, а затем открыли к нему публичный доступ через сервис. Развёртывание создало только один под, в котором работает наше приложение. По мере увеличения трафика необходимо будет промасштабировать приложение, чтобы оно могло справиться с возросшим потоком пользователей.

+ +

Масштабирование осуществляется за счёт изменения количества реплик в развёртывании.

+ +
+
+
+

Краткое содержание:

+
    +
  • Масштабирование развёртывания
  • +
+
+
+

Количество экземпляров можно указать прямо при создании развёртывания, используя параметр --replicas команды kubectl run

+
+
+
+
+ +
+
+

Обзор масштабирования

+
+
+ + + +
+ +
+
+

В случае масштабирования развёртывания создаются новые поды, которые распределяются по узлам с доступными ресурсами. Масштабирование увеличит количество подов в соответствии с указанным требуемым состоянием. Kubernetes также поддерживает автоматическое масштабирование подов (не рассматривается в данном уроке). Кроме этого, возможно масштабирование до нуля, тогда завершается работа всех подов в развертывании.

+ +

При запуске нескольких экземпляров приложения нужно правильно распределить трафик между ними. У сервисов есть встроенный балансировщик нагрузки, который распределяет сетевой трафик всех подов в открытом извне развертывания. Сервисы постоянно отслеживают запущенные поды через их конечные точки, чтобы направлять трафик только на доступные поды.

+ +
+
+
+

Масштабирование выполняется с помощью изменения количества реплик в развертывании.

+
+
+
+ +
+ +
+
+

Имея несколько работающих экземпляров приложения можно выполнять плавающие обновления (rolling updates) без простоев. С ними мы познакомимся в следующем модуле. А пока перейдём к онлайн-терминалу и промасштабируем наше приложение.

+
+
+
+ + + +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/update/_index.md b/content/ru/docs/tutorials/kubernetes-basics/update/_index.md new file mode 100644 index 0000000000..53264491d6 --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/update/_index.md @@ -0,0 +1,4 @@ +--- +title: Обновление приложения +weight: 60 +--- diff --git a/content/ru/docs/tutorials/kubernetes-basics/update/update-interactive.html b/content/ru/docs/tutorials/kubernetes-basics/update/update-interactive.html new file mode 100644 index 0000000000..5dbfa154df --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/update/update-interactive.html @@ -0,0 +1,37 @@ +--- +title: Интерактивный урок - Обновление приложения +weight: 20 +--- + + + + + + + + + + + +
+ +
+ +
+
+ Для работы с терминалом, пожалуйста, используйте компьютер или планшет +
+
+
+
+ +
+ +
+ + + diff --git a/content/ru/docs/tutorials/kubernetes-basics/update/update-intro.html b/content/ru/docs/tutorials/kubernetes-basics/update/update-intro.html new file mode 100644 index 0000000000..38a744cbcb --- /dev/null +++ b/content/ru/docs/tutorials/kubernetes-basics/update/update-intro.html @@ -0,0 +1,135 @@ +--- +title: Выполнение плавающего обновления +weight: 10 +--- + + + + + + + + + + +
+ +
+ +
+ +
+

Темы

+
    +
  • Выполнение плавающего обновления с помощью kubectl.
  • +
+
+ +
+

Обновление приложения

+

Пользователи надеются, что приложения будут работать круглосуточно, а разработчики в свою очередь ожидают развёртывать новые версии приложений по нескольку раз в день. В Kubernetes это возможно благодаря механизму плавающих обновлений (rolling updates). Плавающие обновления позволяет обновить развёртывания без простоев, шаг за шагом заменяя старые поды на новые. Новые поды будут запущены на узлах, имеющих достаточно ресурсов.

+ +

В предыдущем модуле мы промасштабировали приложение до нескольких экземпляров. Это необходимо сделать, чтобы иметь возможность обновлять приложение, не влияя на его доступность. По умолчанию максимальное количество подов, которое может быть недоступно во время обновления, и максимальное количество новых подов, которое можно создать, равны 1. Эти две опции могут быть определены в абсолютном (числа) или относительном соотношении (проценты). + В Kubernetes обновления версионируются, поэтому любое обновление развёртывания можно откатить до предыдущей (стабильной) версии.

+ +
+
+
+

Краткое содержание:

+
    +
  • Обновление приложения
  • +
+
+
+

Плавающие обновления последовательно заменяют экземпляры подов на новые, тем самым позволяя обновить развёртывания без простоев

+
+
+
+
+ +
+
+

Обзор плавающих обновлений

+
+
+
+
+
+ +
+
+
+ +
+
+

Подобно масштабированию приложения, если развёртывание доступно извне, при обновлении сервис будет балансировать трафик только между доступными подами. Доступный под — это экземпляр, который может быть запущен для пользователей приложения.

+ +

С помощью плавающих обновлений можно:

+
    +
  • Переводить приложение из одного окружения в другое (через обновления образа контейнера)
  • +
  • Откатываться к предыдущим версиям
  • +
  • Осуществлять непрерывную интеграцию и непрерывную доставку приложений без простоев
  • + +
+ +
+
+
+

Если развёртывание было открыто наружу, в процессе обновления сервис будет балансировать нагрузку трафика только на доступные поды.

+
+
+
+ +
+ +
+
+

В следующем интерактивном уроке мы обновим приложение до новой версии, а потом выполним откат, т.е. вернёмся к предыдущей версии

+
+
+
+ + + +
+ +
+ + + From 4b1a41b1ca7c199b9e7642a58f91f8f7734447de Mon Sep 17 00:00:00 2001 From: Prasad Katti Date: Thu, 7 May 2020 14:25:29 -0700 Subject: [PATCH 39/67] Fix cluster state in example on Disruptions concept page --- content/en/docs/concepts/workloads/pods/disruptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/docs/concepts/workloads/pods/disruptions.md b/content/en/docs/concepts/workloads/pods/disruptions.md index 00265e0433..5a73490505 100644 --- a/content/en/docs/concepts/workloads/pods/disruptions.md +++ b/content/en/docs/concepts/workloads/pods/disruptions.md @@ -211,7 +211,7 @@ state: | node-1 *drained* | node-2 | node-3 | *no node* | |:--------------------:|:-------------------:|:------------------:|:------------------:| -| | pod-b *available* | pod-c *available* | pod-e *pending* | +| | pod-b *terminating* | pod-c *available* | pod-e *pending* | | | pod-d *available* | pod-y | | At this point, the cluster administrator needs to From 7868348a8708b8b0385deb18878e4d36d16085d6 Mon Sep 17 00:00:00 2001 From: Arhell Date: Fri, 8 May 2020 00:33:43 +0300 Subject: [PATCH 40/67] remove white bar on the blog page --- static/css/blog.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/css/blog.css b/static/css/blog.css index c584ee4e53..90bb0c0260 100644 --- a/static/css/blog.css +++ b/static/css/blog.css @@ -497,6 +497,10 @@ img.big-img { overflow-x: scroll; } +.flyout-button { + display: none; +} + /* .content img { max-width: 100%; } */ From d1ff4e7c12f451dfc7f2c6c4c0734f2496c73c5f Mon Sep 17 00:00:00 2001 From: fml2 Date: Sun, 3 May 2020 15:21:47 +0200 Subject: [PATCH 41/67] Document that UTF-8 is used when exposing configMaps as files --- content/en/docs/concepts/storage/volumes.md | 5 +++++ .../tasks/configure-pod-container/configure-pod-configmap.md | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/content/en/docs/concepts/storage/volumes.md b/content/en/docs/concepts/storage/volumes.md index 537a813ded..ac72a32555 100644 --- a/content/en/docs/concepts/storage/volumes.md +++ b/content/en/docs/concepts/storage/volumes.md @@ -305,6 +305,11 @@ A Container using a ConfigMap as a [subPath](#using-subpath) volume mount will n receive ConfigMap updates. {{< /note >}} +{{< note >}} +Text data is exposed as files using the UTF-8 character encoding. To use some other character encoding, use binaryData. +{{< /note >}} + + ### downwardAPI {#downwardapi} A `downwardAPI` volume is used to make downward API data available to applications. diff --git a/content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md b/content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md index 71fad95de9..c7f80b0fad 100644 --- a/content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md +++ b/content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md @@ -588,6 +588,10 @@ SPECIAL_TYPE If there are some files in the `/etc/config/` directory, they will be deleted. {{< /caution >}} +{{< note >}} +Text data is exposed as files using the UTF-8 character encoding. To use some other character encoding, use binaryData. +{{< /note >}} + ### Add ConfigMap data to a specific path in the Volume Use the `path` field to specify the desired file path for specific ConfigMap items. From d1952bf98c810acddab068da8c39e36a45d34b94 Mon Sep 17 00:00:00 2001 From: Prasad Katti Date: Thu, 7 May 2020 15:43:37 -0700 Subject: [PATCH 42/67] Add feature state for PodDisruptionBudget --- content/en/docs/concepts/workloads/pods/disruptions.md | 2 ++ content/en/docs/tasks/run-application/configure-pdb.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/content/en/docs/concepts/workloads/pods/disruptions.md b/content/en/docs/concepts/workloads/pods/disruptions.md index 00265e0433..1287763e51 100644 --- a/content/en/docs/concepts/workloads/pods/disruptions.md +++ b/content/en/docs/concepts/workloads/pods/disruptions.md @@ -97,6 +97,8 @@ time as frequent voluntary disruptions. We call this set of features ## How Disruption Budgets Work +{{< feature-state for_k8s_version="v1.5" state="beta" >}} + An Application Owner can create a `PodDisruptionBudget` object (PDB) for each application. A PDB limits the number of pods of a replicated application that are down simultaneously from voluntary disruptions. For example, a quorum-based application would diff --git a/content/en/docs/tasks/run-application/configure-pdb.md b/content/en/docs/tasks/run-application/configure-pdb.md index d33dc24364..d98538c262 100644 --- a/content/en/docs/tasks/run-application/configure-pdb.md +++ b/content/en/docs/tasks/run-application/configure-pdb.md @@ -6,6 +6,8 @@ weight: 110 {{% capture overview %}} +{{< feature-state for_k8s_version="v1.5" state="beta" >}} + This page shows how to limit the number of concurrent disruptions that your application experiences, allowing for higher availability while permitting the cluster administrator to manage the clusters From 0fc77adf642949e5410810c4e35c8a91aa608749 Mon Sep 17 00:00:00 2001 From: bryan Date: Fri, 8 May 2020 09:48:13 +0800 Subject: [PATCH 43/67] resolve conversation --- .../zh/docs/concepts/configuration/configmap.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/zh/docs/concepts/configuration/configmap.md b/content/zh/docs/concepts/configuration/configmap.md index 26afa91d29..0658b11ab6 100644 --- a/content/zh/docs/concepts/configuration/configmap.md +++ b/content/zh/docs/concepts/configuration/configmap.md @@ -1,12 +1,12 @@ --- -title: ConfigMaps +title: ConfigMap content_template: templates/concept weight: 20 --- {{% capture overview %}} -{{< glossary_definition term_id="configmap" prepend="A ConfigMap is" length="all" >}} +{{< glossary_definition term_id="configmap" prepend="ConfigMap 是" length="all" >}} {{< caution >}} -ConfigMaps 最常见的用法是为同一命名空间里某 Pod 中运行的容器执行配置。您也可以单独使用 ConfigMap。 +ConfigMap 最常见的用法是为同一命名空间里某 Pod 中运行的容器执行配置。您也可以单独使用 ConfigMap。 -比如,您可能会遇到基于 ConfigMap 来调整其行为的 {{< glossary_tooltip text="addons" term_id="addons" >}} 或者 {{< glossary_tooltip text="operators" term_id="operator-pattern" >}}。 +比如,您可能会遇到基于 ConfigMap 来调整其行为的 {{< glossary_tooltip text="插件" term_id="addons" >}} 或者 {{< glossary_tooltip text="operator" term_id="operator-pattern" >}}。 {{< /note >}} @@ -222,7 +222,7 @@ ConfigMaps 最常见的用法是为同一命名空间里某 Pod 中运行的容 * Read [The Twelve-Factor App](https://12factor.net/) to understand the motivation for separating code from configuration. --> -* 阅读 [Secrets](/docs/concepts/configuration/secret/)。 +* 阅读 [Secret](/docs/concepts/configuration/secret/)。 * 阅读 [配置 Pod 来使用 ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/)。 * 阅读 [Twelve-Factor 应用](https://12factor.net/) 来了解将代码和配置分开的动机。 From 10b003ee07895ab6765f2dadc638a118be7cc557 Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Fri, 8 May 2020 09:59:03 +0300 Subject: [PATCH 44/67] Improve content and update links in Russian translation --- content/ru/docs/tutorials/_index.md | 22 ++++++++++----------- content/ru/docs/tutorials/hello-minikube.md | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/content/ru/docs/tutorials/_index.md b/content/ru/docs/tutorials/_index.md index b79c7c822f..4f677cec0e 100644 --- a/content/ru/docs/tutorials/_index.md +++ b/content/ru/docs/tutorials/_index.md @@ -7,7 +7,7 @@ content_template: templates/concept {{% capture overview %}} -В данном разделе документации Kubernetes можно найти руководства. В них рассказывается, как достичь определённой цели, а не просто выполнить одно задачу (/docs/tasks/). Большинство уроков состоит из нескольких разделов, каждый из которых включает в себя шаги для последовательного выполнения. Перед тем как приступить к выполнению уроков, может быть полезно ознакомиться со [словарем терминов](/docs/reference/glossary/) для последующих обращений. +В данном разделе документации Kubernetes можно найти руководства. В них рассказывается, как достичь определённой цели, а не просто выполнить одну [задачу](/docs/tasks/). Большинство уроков состоит из нескольких разделов, каждый из которых включает в себя шаги для последовательного выполнения. Перед тем как приступить к выполнению уроков, может быть полезно ознакомиться со [словарем терминов](/ru/docs/reference/glossary/) для последующих обращений. {{% /capture %}} @@ -15,25 +15,25 @@ content_template: templates/concept ## Основы -* [Основы Kubernetes](/docs/tutorials/kubernetes-basics/) - глубокое интерактивное руководство, направленное на понимание системы и предлагающее попробовать некоторые основные возможности Kubernetes. +* [Основы Kubernetes](/ru/docs/tutorials/kubernetes-basics/) - подробное интерактивное руководство, направленное на понимание системы и предлагающее попробовать некоторые основные возможности Kubernetes. * [Масштабируемые микросервисы с Kubernetes (Udacity)](https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615) * [Введение в Kubernetes (edX)](https://www.edx.org/course/introduction-kubernetes-linuxfoundationx-lfs158x#) -* [Hello Minikube](/docs/tutorials/hello-minikube/) +* [Привет, Minikube](/ru/docs/tutorials/hello-minikube/) ## Конфигурирование * [Конфигурирование Redis с использованием ConfigMap](/docs/tutorials/configuration/configure-redis-using-configmap/) -## Stateless приложения +## Приложения без состояния * [Установка внешнего IP адреса для получения доступа к приложению в кластере](/docs/tutorials/stateless-application/expose-external-ip-address/) * [Пример: развёртывание приложения "Гостевая книга" на PHP с использованием Redis](/docs/tutorials/stateless-application/guestbook/) -## Stateful приложения +## Приложения с состоянием * [Основы StatefulSet](/docs/tutorials/stateful-application/basic-stateful-set/) @@ -43,21 +43,21 @@ content_template: templates/concept * [Запуск ZooKeeper, A CP Distributed System](/docs/tutorials/stateful-application/zookeeper/) -## CI/CD пайплайн +## Конвейерная обработка CI/CD -* [Настройка CI/CD пайплайна с Kubernetes Часть 1: Обзор](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/5/set-cicd-pipeline-kubernetes-part-1-overview) +* [Настройка конвейера CI/CD с Kubernetes Часть 1: Обзор](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/5/set-cicd-pipeline-kubernetes-part-1-overview) -* [Настройка CI/CD пайплайна с подом Jenkins в Kubernetes (Часть 2)](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/6/set-cicd-pipeline-jenkins-pod-kubernetes-part-2) +* [Настройка конвейера CI/CD с подом Jenkins в Kubernetes (Часть 2)](https://www.linux.com/blog/learn/chapter/Intro-to-Kubernetes/2017/6/set-cicd-pipeline-jenkins-pod-kubernetes-part-2) * [Запуск и масштабирование приложения распределённого кроссворда с CI/CD в Kubernetes (Часть 3)](https://www.linux.com/blog/learn/chapter/intro-to-kubernetes/2017/6/run-and-scale-distributed-crossword-puzzle-app-cicd-kubernetes-part-3) * [Настройка CI/CD для приложения распределённого кроссворда в Kubernetes (Часть 4)](https://www.linux.com/blog/learn/chapter/intro-to-kubernetes/2017/6/set-cicd-distributed-crossword-puzzle-app-kubernetes-part-4) -## Clusters +## Кластеры * [AppArmor](/docs/tutorials/clusters/apparmor/) -## Services +## Сервисы * [Использование IP](/docs/tutorials/services/source-ip/) @@ -65,6 +65,6 @@ content_template: templates/concept {{% capture whatsnext %}} -Если вы хотите создать руководство самостоятельно, обратитесь к странице [Использование шаблонов страниц](/docs/home/contribute/page-templates/), чтобы узнать информацию и посмотреть шаблоны для составления руководств. +Если вы хотите создать руководство самостоятельно, обратитесь к странице [Использование шаблонов страниц](/ru/docs/home/contribute/page-templates/), чтобы узнать информацию и посмотреть шаблоны для составления руководств. {{% /capture %}} diff --git a/content/ru/docs/tutorials/hello-minikube.md b/content/ru/docs/tutorials/hello-minikube.md index 7bbb5b0f2b..6891fd88fc 100644 --- a/content/ru/docs/tutorials/hello-minikube.md +++ b/content/ru/docs/tutorials/hello-minikube.md @@ -1,5 +1,5 @@ --- -title: Привет Minikube +title: Привет, Minikube content_template: templates/tutorial weight: 5 menu: From e052cc3a09f18b3ae03a7066252c4e0df5b13555 Mon Sep 17 00:00:00 2001 From: Giri Kuncoro Date: Fri, 8 May 2020 04:48:43 +0700 Subject: [PATCH 45/67] Translate kubectl cheatsheet to Bahasa Indonesia --- content/id/docs/reference/kubectl/_index.md | 4 + .../id/docs/reference/kubectl/cheatsheet.md | 401 ++++++++++++++++++ 2 files changed, 405 insertions(+) create mode 100644 content/id/docs/reference/kubectl/_index.md create mode 100644 content/id/docs/reference/kubectl/cheatsheet.md diff --git a/content/id/docs/reference/kubectl/_index.md b/content/id/docs/reference/kubectl/_index.md new file mode 100644 index 0000000000..5580fc654a --- /dev/null +++ b/content/id/docs/reference/kubectl/_index.md @@ -0,0 +1,4 @@ +--- +title: "Baris Perintah kubectl" +weight: 60 +--- diff --git a/content/id/docs/reference/kubectl/cheatsheet.md b/content/id/docs/reference/kubectl/cheatsheet.md new file mode 100644 index 0000000000..80667814ac --- /dev/null +++ b/content/id/docs/reference/kubectl/cheatsheet.md @@ -0,0 +1,401 @@ +--- +title: Contekan kubectl +content_template: templates/concept +card: + name: reference + weight: 30 +--- + +{{% capture overview %}} + +Lihat juga: [Ikhitsar Kubectl](/docs/reference/kubectl/overview/) dan [Panduan JsonPath](/docs/reference/kubectl/jsonpath). + +Laman ini merupakan ikhitisar dari perintah `kubectl`. + +{{% /capture %}} + +{{% capture body %}} + +# kubectl - Contekan + +## Autocomplete Kubectl + +### BASH + +```bash +source <(kubectl completion bash) # menyiapkan autocomplete untuk bash ke dalam shell saat ini, paket bash-completion harus diinstal terlebih dahulu. +echo "source <(kubectl completion bash)" >> ~/.bashrc # menambahkan autocomplete secara permanen ke dalam bash shell kamu. +``` + +Kamu juga dapat menggunakan alias singkatan untuk `kubectl` yang juga bisa berfungsi dengan _completion_: + +```bash +alias k=kubectl +complete -F __start_kubectl k +``` + +### ZSH + + +```bash +source <(kubectl completion zsh) # menyiapkan autocomplete untuk zsh ke dalam shell saat ini. +echo "[[ $commands[kubectl] ]] && source <(kubectl completion zsh)" >> ~/.zshrc # menambahkan autocomplete secara permanen ke dalam zsh shell kamu. +``` + +## Konteks Kubectl dan Konfigurasinya + +Memilih klaster Kubernetes yang mana yang ditembak oleh `kubectl` untuk berkomunikasi dan +diubah konfigurasinya. Lihat dokumentasi [Otentikasi ke berbagai Klaster dengan kubeconfig](/id/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) untuk mengetahui informasi tentang berkas konfigurasi ini secara detail. + +```bash +kubectl config view # memperlihatkan setelan kubeconfig yang sudah digabung (merged) + +# menggunakan beberapa berkas kubeconfig sekaligus dan melihat semua konfigurasinya sekaligus (merged) +KUBECONFIG=~/.kube/config:~/.kube/kubconfig2 + +kubectl config view + +# mendapatkan kata sandi untuk pengguna e2e +kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}' + +kubectl config view -o jsonpath='{.users[].name}' # memperlihatkan pengguna pertama +kubectl config view -o jsonpath='{.users[*].name}' # mendapatkan daftar pengguna +kubectl config get-contexts # memperlihatkan daftar konteks +kubectl config current-context # memperlihatkan konteks saat ini +kubectl config use-context my-cluster-name # menyetel konteks bawaan menjadi my-cluster-name + +# menambahkan seorang pengguna baru ke dalam kubeconf kamu yang mendukung basic auth +kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword + +# menyimpan Namespace secara permanen untuk semua perintah kubectl pada konteks tersebut +kubectl config set-context --current --namespace=ggckad-s2 + +# menyetel konteks yang menggunakan pengguna dan namespace yang spesifik +kubectl config set-context gce --user=cluster-admin --namespace=foo \ + && kubectl config use-context gce + +kubectl config unset users.foo # menghapus pengguna foo +``` + +## Menerapkan + +`apply` (menerapkan) mengelola aplikasi melalui berkas-berkas yang berisi definisi tentang sumber daya Kubernetes. Perintah ini membuat dan memperbarui +sumber daya di dalam sebuah klaster dengan menjalankan `kubectl apply`. Ini merupakan cara yang disarankan untuk mengelola aplikasi di dalam _production_. +Lihat [Buku Kubectl](https://kubectl.docs.kubernetes.io). + +## Membuat Objek + +Manifes Kubernetes dapat didefinisikan ke dalam YAML atau JSON. Gunakan berkas dengan ekstensi `.yaml`, +`.yml`, dan `.json`. + +```bash +kubectl apply -f ./my-manifest.yaml # membuat sumber daya +kubectl apply -f ./my1.yaml -f ./my2.yaml # membuat sumber daya dari beberapa berkas +kubectl apply -f ./dir # membuat sumber daya dari berbagai berkas manifes yang ada di dalam direktori +kubectl apply -f https://git.io/vPieo # membuat sumber daya dari sebuah tautan +kubectl create deployment nginx --image=nginx # memulai sebuah instans tunggal nginx +kubectl explain pods # mendapatkan dokumentasi untuk manifes Pod + +# membuat beberapa objek YAML dari masukan (stdin) +cat < pod.yaml + +kubectl attach my-pod -i # melekatkan (meng-attach) ke dalam kontainer yang sedang berjalan +kubectl port-forward my-pod 5000:6000 # mendengar (listen) pada porta 5000 di mesin lokal dan meneruskan ke porta 6000 di Pod my-pod +kubectl exec my-pod -- ls / # menjalankan perintah pada Pod my-pod (kasus 1 kontainer) +kubectl exec my-pod -c my-container -- ls / # menjalankan peirntah pada Pod my-pod (kasus banyak kontainer) +kubectl top pod POD_NAME --containers # memperlihatkan metrik yang dimiliki Pod bersama kontainernya +``` + +## Berinteraksi dengan Node dan Klaster + +```bash +kubectl cordon my-node # menandai my-node supaya tidak bisa dijadwalkan dengan Pod (unschedulable) +kubectl drain my-node # mengeringkan (drain) my-node sebagai bagian dari persiapan untuk pemeliharaan +kubectl uncordon my-node # menandai my-node supaya bisa dijadwalkan dengan Pod (schedulable) +kubectl top node my-node # memperlihatkan metrik dari Node my-node +kubectl cluster-info # memperlihatkan alamaat dari master dan layanan +kubectl cluster-info dump # memperlihatkan state klaster saat ini pada keluaran stdout +kubectl cluster-info dump --output-directory=/path/to/cluster-state # memperlihatkan state klaster saat ini pada /path/to/cluster-state + +# jika sebuah taint dengan sebuah kunci dan efek di bawah pernah diterapkan, maka nilainya akan tergantikan dengan yang baru +kubectl taint nodes foo dedicated=special-user:NoSchedule +``` + +### Berbagai Tipe Sumber Daya + +Mendapatkan seluruh daftar tipe sumber daya yang didukung lengkap dengan singkatan pendeknya, [grup API](/docs/concepts/overview/kubernetes-api/#api-groups), +apakah sumber daya merupakan sumber daya yang berada di dalam Namespace atau tidak, serta [Kind](/docs/concepts/overview/working-with-objects/kubernetes-objects): + +```bash +kubectl api-resources +``` + +Operasi lainnya yang berkaitan dengan sumber daya API (api-resources): + +```bash +kubectl api-resources --namespaced=true # semua sumber daya yang berada di dalam Namespace +kubectl api-resources --namespaced=false # semua sumber daya yang tidak berada di dalam Namespace +kubectl api-resources -o name # semua sumber daya dengan keluaran sederhana (hanya nama sumber daya) +kubectl api-resources -o wide # semua sumber daya dengan keluaran tambahan ("wide") +kubectl api-resources --verbs=list,get # semua sumber daya yang mendukung verb permintaan "list" dan "get" +kubectl api-resources --api-group=extensions # semua sumber daya di dalam grup API "extensions" +``` + +### Memformat Keluaran + + +Untuk mengeluarkan detail ke dalam jendela terminal kamu dengan format tertentu, tambahkan _flag_ `-o` (atau `--output`) +dengan perintah `kubectl` yang didukung. + +Format keluaran | Deskripsi +--------------| ----------- +`-o=custom-columns=` | Mencetak sebuah tabel dengan daftar kolom khas (_custom_) yang dipisahkan dengan koma +`-o=custom-columns-file=` | Mencetak sebuah tabel dengan templat kolom khas pada berkas `` +`-o=json` | Memberikan keluaran objek API dengan format JSON +`-o=jsonpath=