Merge main into dev-1.31 to keep in sync
commit
7eef38ea41
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
---
|
||||||
|
layout: blog
|
||||||
|
title: 'Introducing Feature Gates to Client-Go: Enhancing Flexibility and Control'
|
||||||
|
date: 2024-08-12
|
||||||
|
slug: feature-gates-in-client-go
|
||||||
|
author: >
|
||||||
|
Ben Luddy (Red Hat),
|
||||||
|
Lukasz Szaszkiewicz (Red Hat)
|
||||||
|
---
|
||||||
|
|
||||||
|
Kubernetes components use on-off switches called _feature gates_ to manage the risk of adding a new feature.
|
||||||
|
The feature gate mechanism is what enables incremental graduation of a feature through the stages Alpha, Beta, and GA.
|
||||||
|
|
||||||
|
Kubernetes components, such as kube-controller-manager and kube-scheduler, use the client-go library to interact with the API.
|
||||||
|
The same library is used across the Kubernetes ecosystem to build controllers, tools, webhooks, and more. client-go now includes
|
||||||
|
its own feature gating mechanism, giving developers and cluster administrators more control over how they adopt client features.
|
||||||
|
|
||||||
|
To learn more about feature gates in Kubernetes, visit [Feature Gates](/docs/reference/command-line-tools-reference/feature-gates/).
|
||||||
|
|
||||||
|
## Motivation
|
||||||
|
|
||||||
|
In the absence of client-go feature gates, each new feature separated feature availability from enablement in its own way, if at all.
|
||||||
|
Some features were enabled by updating to a newer version of client-go. Others needed to be actively configured in each program that used them.
|
||||||
|
A few were configurable at runtime using environment variables. Consuming a feature-gated functionality exposed by the kube-apiserver sometimes
|
||||||
|
required a client-side fallback mechanism to remain compatible with servers that don’t support the functionality due to their age or configuration.
|
||||||
|
In cases where issues were discovered in these fallback mechanisms, mitigation required updating to a fixed version of client-go or rolling back.
|
||||||
|
|
||||||
|
None of these approaches offer good support for enabling a feature by default in some, but not all, programs that consume client-go.
|
||||||
|
Instead of enabling a new feature at first only for a single component, a change in the default setting immediately affects the default
|
||||||
|
for all Kubernetes components, which broadens the blast radius significantly.
|
||||||
|
|
||||||
|
## Feature gates in client-go
|
||||||
|
|
||||||
|
To address these challenges, substantial client-go features will be phased in using the new feature gate mechanism.
|
||||||
|
It will allow developers and users to enable or disable features in a way that will be familiar to anyone who has experience
|
||||||
|
with feature gates in the Kubernetes components.
|
||||||
|
|
||||||
|
Out of the box, simply by using a recent version of client-go, this offers several benefits.
|
||||||
|
|
||||||
|
For people who use software built with client-go:
|
||||||
|
|
||||||
|
|
||||||
|
* Early adopters can enable a default-off client-go feature on a per-process basis.
|
||||||
|
* Misbehaving features can be disabled without building a new binary.
|
||||||
|
* The state of all known client-go feature gates is logged, allowing users to inspect it.
|
||||||
|
|
||||||
|
For people who develop software built with client-go:
|
||||||
|
|
||||||
|
* By default, client-go feature gate overrides are read from environment variables.
|
||||||
|
If a bug is found in a client-go feature, users will be able to disable it without waiting for a new release.
|
||||||
|
* Developers can replace the default environment-variable-based overrides in a program to change defaults,
|
||||||
|
read overrides from another source, or disable runtime overrides completely.
|
||||||
|
The Kubernetes components use this customizability to integrate client-go feature gates with
|
||||||
|
the existing `--feature-gates` command-line flag, feature enablement metrics, and logging.
|
||||||
|
|
||||||
|
## Overriding client-go feature gates
|
||||||
|
|
||||||
|
**Note**: This describes the default method for overriding client-go feature gates at runtime.
|
||||||
|
It can be disabled or customized by the developer of a particular program.
|
||||||
|
In Kubernetes components, client-go feature gate overrides are controlled by the `--feature-gates` flag.
|
||||||
|
|
||||||
|
Features of client-go can be enabled or disabled by setting environment variables prefixed with `KUBE_FEATURE`.
|
||||||
|
For example, to enable a feature named `MyFeature`, set the environment variable as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
KUBE_FEATURE_MyFeature=true
|
||||||
|
```
|
||||||
|
|
||||||
|
To disable the feature, set the environment variable to `false`:
|
||||||
|
|
||||||
|
```
|
||||||
|
KUBE_FEATURE_MyFeature=false
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: Environment variables are case-sensitive on some operating systems.
|
||||||
|
Therefore, `KUBE_FEATURE_MyFeature` and `KUBE_FEATURE_MYFEATURE` would be considered two different variables.
|
||||||
|
|
||||||
|
## Customizing client-go feature gates
|
||||||
|
|
||||||
|
The default environment-variable based mechanism for feature gate overrides can be sufficient for many programs in the Kubernetes ecosystem,
|
||||||
|
and requires no special integration. Programs that require different behavior can replace it with their own custom feature gate provider.
|
||||||
|
This allows a program to do things like force-disable a feature that is known to work poorly,
|
||||||
|
read feature gates directly from a remote configuration service, or accept feature gate overrides through command-line options.
|
||||||
|
|
||||||
|
The Kubernetes components replace client-go’s default feature gate provider with a shim to the existing Kubernetes feature gate provider.
|
||||||
|
For all practical purposes, client-go feature gates are treated the same as other Kubernetes
|
||||||
|
feature gates: they are wired to the `--feature-gates` command-line flag, included in feature enablement metrics, and logged on startup.
|
||||||
|
|
||||||
|
To replace the default feature gate provider, implement the Gates interface and call ReplaceFeatureGates
|
||||||
|
at package initialization time, as in this simple example:
|
||||||
|
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
“k8s.io/client-go/features”
|
||||||
|
)
|
||||||
|
|
||||||
|
type AlwaysEnabledGates struct{}
|
||||||
|
|
||||||
|
func (AlwaysEnabledGates) Enabled(features.Feature) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
features.ReplaceFeatureGates(AlwaysEnabledGates{})
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Implementations that need the complete list of defined client-go features can get it by implementing the Registry interface
|
||||||
|
and calling `AddFeaturesToExistingFeatureGates`.
|
||||||
|
For a complete example, refer to [the usage within Kubernetes](https://github.com/kubernetes/kubernetes/blob/64ba17c605a41700f7f4c4e27dca3684b593b2b9/pkg/features/kube_features.go#L990-L997).
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
With the introduction of feature gates in client-go v1.30, rolling out a new client-go feature has become safer and easier.
|
||||||
|
Users and developers can control the pace of their own adoption of client-go features.
|
||||||
|
The work of Kubernetes contributors is streamlined by having a common mechanism for graduating features that span both sides of the Kubernetes API boundary.
|
||||||
|
|
||||||
|
Special shoutout to [@sttts](https://github.com/sttts) and [@deads2k](https://github.com/deads2k) for their help in shaping this feature.
|
|
@ -258,6 +258,11 @@ indicates one of the following reasons for the Pod termination:
|
||||||
the [graceful node shutdown](/docs/concepts/architecture/nodes/#graceful-node-shutdown),
|
the [graceful node shutdown](/docs/concepts/architecture/nodes/#graceful-node-shutdown),
|
||||||
or preemption for [system critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/).
|
or preemption for [system critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/).
|
||||||
|
|
||||||
|
In all other disruption scenarios, like eviction due to exceeding
|
||||||
|
[Pod container limits](/docs/concepts/configuration/manage-resources-containers/),
|
||||||
|
Pods don't receive the `DisruptionTarget` condition because the disruptions were
|
||||||
|
probably caused by the Pod and would reoccur on retry.
|
||||||
|
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
A Pod disruption might be interrupted. The control plane might re-attempt to
|
A Pod disruption might be interrupted. The control plane might re-attempt to
|
||||||
continue the disruption of the same Pod, but it is not guaranteed. As a result,
|
continue the disruption of the same Pod, but it is not guaranteed. As a result,
|
||||||
|
|
|
@ -15,6 +15,7 @@ You can use the Kubernetes command line tool `kubectl` to interact with the API
|
||||||
## docker run
|
## docker run
|
||||||
|
|
||||||
To run an nginx Deployment and expose the Deployment, see [kubectl create deployment](/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-).
|
To run an nginx Deployment and expose the Deployment, see [kubectl create deployment](/docs/reference/generated/kubectl/kubectl-commands#-em-deployment-em-).
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: "autocompletado con fish"
|
title: "Autocompletado con Fish"
|
||||||
description: "Configuración opcional para habilitar el autocompletado en la shell fish."
|
description: "Configuración opcional para habilitar el autocompletado de la shell Fish"
|
||||||
headless: true
|
headless: true
|
||||||
_build:
|
_build:
|
||||||
list: never
|
list: never
|
||||||
|
@ -9,12 +9,12 @@ _build:
|
||||||
---
|
---
|
||||||
|
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
El autocompletado para Fish necesita de kubectl versión 1.23 o superior.
|
Se requiere kubectl 1.23 o superior para utilizar el autocompletado de Fish.
|
||||||
{{< /note >}}
|
{{< /note >}}
|
||||||
|
|
||||||
El script de autocompletado de Fish para kubectl puede ser generado con el comando `kubectl completion fish`. Ejecutando este comando en tu shell habilitará el autocompletado de kubectl para Fish.
|
El script de autocompletado de Fish puede ser generado con el comando `kubectl completion fish`. Leyendo este archivo en su Shell habilita el autocompletado de kubectl.
|
||||||
|
|
||||||
Para qué funcione en sus futuras sesiones shell, debes agregar la siguiente línea al archivo `~/.config/fish/config.fish`:
|
Para hacer esto en todas sus sesiones agregue la siguiente linea a su archivo `~/.config/fish/config.fish`:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl completion fish | source
|
kubectl completion fish | source
|
||||||
|
|
|
@ -0,0 +1,301 @@
|
||||||
|
---
|
||||||
|
title: Instalar y Configurar kubectl en macOS
|
||||||
|
content_type: task
|
||||||
|
weight: 10
|
||||||
|
---
|
||||||
|
|
||||||
|
## {{% heading "prerequisites" %}}
|
||||||
|
|
||||||
|
Se debe utilizar la versión de kubectl con la menor diferencia de versión de respecto de
|
||||||
|
su clúster. Por ejemplo, un cliente con versión v{{< skew currentVersion >}} se puede comunicar
|
||||||
|
con los siguientes versiones de plano de control v{{< skew currentVersionAddMinor -1 >}},
|
||||||
|
v{{< skew currentVersionAddMinor 0 >}}, and v{{< skew currentVersionAddMinor 1 >}}.
|
||||||
|
Utilizar la última versión compatible de kubectl evita posibles errores.
|
||||||
|
|
||||||
|
## Instalar kubectl en macOS
|
||||||
|
|
||||||
|
Existen los siguientes métodos para instalar kubectl en macOS:
|
||||||
|
|
||||||
|
- [Instalar kubectl en macOS](#instalar-kubectl-en-macos)
|
||||||
|
- [Instalación del binario para macOS con Curl](#instalación-del-binario-para-macos-de-kubectl-con-curl)
|
||||||
|
- [Instalar con Homebrew en macOS](#instalar-utilizando-homebrew-en-macos)
|
||||||
|
- [Instalar con Macports en macOS](#instalar-con-macports-en-macos)
|
||||||
|
- [Verificar la configuración de kubectl](#verificar-la-configuración-de-kubectl)
|
||||||
|
- [Configuraciones y plugins opcionales para kubectl](#configuraciones-opcionales-y-plugins-de-kubectl)
|
||||||
|
- [Habilitar el autocompletado de la shell](#habilitar-el-autocompletado-en-la-shell)
|
||||||
|
- [Instalar el plugin `kubectl convert`](#instalar-el-plugin-kubectl-convert)
|
||||||
|
|
||||||
|
### Instalación del binario para macOS de kubectl con Curl
|
||||||
|
|
||||||
|
1. Descargar la última versión con el siguiente comando:
|
||||||
|
|
||||||
|
{{< tabs name="download_binary_macos" >}}
|
||||||
|
{{< tab name="Intel" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< tab name="Apple Silicon" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
Para descargar una versión específica, reemplaza la siguiente parte del comando con la
|
||||||
|
versión que deseas instalar `$(curl -L -s https://dl.k8s.io/release/stable.txt)`
|
||||||
|
|
||||||
|
Por ejemplo, para descargar la versión {{< skew currentPatchVersion >}} en macOS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -LO "https://dl.k8s.io/release/v{{< skew currentPatchVersion >}}/bin/darwin/amd64/kubectl"
|
||||||
|
```
|
||||||
|
|
||||||
|
Para macOS con procesador Apple Silicon, ejecuta:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -LO "https://dl.k8s.io/release/v{{< skew currentPatchVersion >}}/bin/darwin/arm64/kubectl"
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< /note >}}
|
||||||
|
|
||||||
|
1. Validación del binario (paso opcional)
|
||||||
|
|
||||||
|
Descargar el archivo checksum:
|
||||||
|
|
||||||
|
{{< tabs name="download_checksum_macos" >}}
|
||||||
|
{{< tab name="Intel" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl.sha256"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< tab name="Apple Silicon" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl.sha256"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
Validar el binario de kubectl contra el archivo checksum:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "$(cat kubectl.sha256) kubectl" | shasum -a 256 --check
|
||||||
|
```
|
||||||
|
|
||||||
|
Si es válido, vas a obtener la siguiente respuesta:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl: OK
|
||||||
|
```
|
||||||
|
|
||||||
|
En caso de falla, `sha256` terminará con un estado diferente a cero con una salida similar a:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl: FAILED
|
||||||
|
shasum: WARNING: 1 computed checksum did NOT match
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
Descargue la misma versión del binario y el checksum.
|
||||||
|
{{< /note >}}
|
||||||
|
|
||||||
|
1. Dar permisos de ejecución al binario.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod +x ./kubectl
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Mover el binario de kubectl al `PATH` de tu sistema.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||||
|
sudo chown root: /usr/local/bin/kubectl
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
Asegúrate que el PATH `/usr/local/bin` forme parte de las variables de entorno.
|
||||||
|
{{< /note >}}
|
||||||
|
|
||||||
|
1. Test para asegurar que la versión instalada está actualizada:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl version --client
|
||||||
|
```
|
||||||
|
|
||||||
|
Se puede utilizar lo siguiente para una vista detallada de la versión:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
kubectl version --client --output=yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Luego de instalar el plugin puede eliminar los archivos de instalación:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm kubectl kubectl.sha256
|
||||||
|
```
|
||||||
|
|
||||||
|
### Instalar utilizando Homebrew en macOS
|
||||||
|
|
||||||
|
Si está utilizando [Homebrew](https://brew.sh/) en macOS,
|
||||||
|
puede instalar kubectl con Homebrew.
|
||||||
|
|
||||||
|
1. Ejecute el comando para instalar:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install kubectl
|
||||||
|
```
|
||||||
|
|
||||||
|
ó
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install kubernetes-cli
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Test para asegurar que la versión instalada está actualizada:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl version --client
|
||||||
|
```
|
||||||
|
|
||||||
|
### Instalar con Macports en macOS
|
||||||
|
|
||||||
|
Si esta en macOS y utiliza [Macports](https://macports.org/),
|
||||||
|
puedes instalar kubectl con Macports.
|
||||||
|
|
||||||
|
1. Ejecute el comando para instalar:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo port selfupdate
|
||||||
|
sudo port install kubectl
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Test para asegurar que la versión instalada está actualizada:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl version --client
|
||||||
|
```
|
||||||
|
|
||||||
|
## Verificar la configuración de kubectl
|
||||||
|
|
||||||
|
{{< include "included/verify-kubectl.md" >}}
|
||||||
|
|
||||||
|
## Configuraciones opcionales y plugins de kubectl
|
||||||
|
|
||||||
|
### Habilitar el autocompletado en la shell
|
||||||
|
|
||||||
|
Kubectl tiene soporte para autocompletar en Bash, Zsh, Fish y Powershell,
|
||||||
|
lo que puede agilizar el tipeo.
|
||||||
|
|
||||||
|
A continuación están los procedimientos para configurarlo en Bash, Fisch y Zsh.
|
||||||
|
|
||||||
|
{{< tabs name="kubectl_autocompletion" >}}
|
||||||
|
{{< tab name="Bash" include="included/optional-kubectl-configs-bash-mac.md" />}}
|
||||||
|
{{< tab name="Fish" include="included/optional-kubectl-configs-fish.md" />}}
|
||||||
|
{{< tab name="Zsh" include="included/optional-kubectl-configs-zsh.md" />}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
### Instalar el plugin `kubectl convert`
|
||||||
|
|
||||||
|
{{< include "included/kubectl-convert-overview.md" >}}
|
||||||
|
|
||||||
|
1. Descarga la última versión con el siguiente comando:
|
||||||
|
|
||||||
|
{{< tabs name="download_convert_binary_macos" >}}
|
||||||
|
{{< tab name="Intel" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< tab name="Apple Silicon" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
1. Valide el binario (opcional)
|
||||||
|
|
||||||
|
Descargue el checksum de kubectl-convert:
|
||||||
|
|
||||||
|
{{< tabs name="download_convert_checksum_macos" >}}
|
||||||
|
{{< tab name="Intel" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl-convert.sha256"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< tab name="Apple Silicon" codelang="bash" >}}
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl-convert.sha256"
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
Ahora se puede validar el binario utilizando el checksum:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "$(cat kubectl-convert.sha256) kubectl-convert" | shasum -a 256 --check
|
||||||
|
```
|
||||||
|
|
||||||
|
Si es válido, la salida será:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl-convert: OK
|
||||||
|
```
|
||||||
|
|
||||||
|
En caso de falla, `sha256` terminará con un estado diferente a cero con una salida similar a esta:
|
||||||
|
|
||||||
|
```console
|
||||||
|
kubectl-convert: FAILED
|
||||||
|
shasum: WARNING: 1 computed checksum did NOT match
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
Descargue la misma versión del binario y del checksum.
|
||||||
|
{{< /note >}}
|
||||||
|
|
||||||
|
1. Dar permisos de ejecución al binario.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod +x ./kubectl-convert
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Mover el binario de kubectl al `PATH` de su sistema.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo mv ./kubectl-convert /usr/local/bin/kubectl-convert
|
||||||
|
sudo chown root: /usr/local/bin/kubectl-convert
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< note >}}
|
||||||
|
Asegúrese que el PATH `/usr/local/bin` forme parte de las variables de entorno.
|
||||||
|
{{< /note >}}
|
||||||
|
|
||||||
|
1. Verificar si el plugin fue instalado correctamente
|
||||||
|
|
||||||
|
```shell
|
||||||
|
kubectl convert --help
|
||||||
|
```
|
||||||
|
|
||||||
|
Si no visualiza ningún error quiere decir que el plugin fue instalado correctamente.
|
||||||
|
|
||||||
|
1. Después de instalar el plugin elimine los archivos de instalación:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm kubectl-convert kubectl-convert.sha256
|
||||||
|
```
|
||||||
|
|
||||||
|
### Eliminar kubectl en macOS
|
||||||
|
|
||||||
|
Dependiendo de como haya instalado `kubectl` puede utilizar uno de los siguientes métodos.
|
||||||
|
|
||||||
|
### Eliminar kubectl usando la linea de comandos
|
||||||
|
|
||||||
|
1. Ubique el binario de `kubectl` en su sistema:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
which kubectl
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Elimine el binario de `kubectl`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo rm <path>
|
||||||
|
```
|
||||||
|
Reemplace `<path>` con el path que apunta al binario de `kubectl` del paso anterior. Por ejemplo, `sudo rm /usr/local/bin/kubectl`
|
||||||
|
|
||||||
|
### Eliminar kubectl utilizando homebrew
|
||||||
|
|
||||||
|
Si instaló `kubectl` utilizando Homebrew ejecute el siguiente comando:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew remove kubectl
|
||||||
|
```
|
||||||
|
|
||||||
|
## {{% heading "whatsnext" %}}
|
||||||
|
|
||||||
|
{{< include "included/kubectl-whats-next.md" >}}
|
|
@ -10,7 +10,7 @@ weight: 20
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ weight: 20
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ Kubernetesでのサービスネットワークの実装は、サービスネッ
|
||||||
|
|
||||||
CiliumはeBPFテクノロジーに基づいており、Linuxネットワークスタックを効率的にオフロードできるため、iptablesベースの従来の方法と比較してパフォーマンスとセキュリティが向上します。
|
CiliumはeBPFテクノロジーに基づいており、Linuxネットワークスタックを効率的にオフロードできるため、iptablesベースの従来の方法と比較してパフォーマンスとセキュリティが向上します。
|
||||||
|
|
||||||
実際には、CiliumとKube-OVNを簡単に[統合]((https://kube-ovn.readthedocs.io/zh-cn/stable/en/advance/with-cilium/))することが可能です。
|
実際には、CiliumとKube-OVNを簡単に[統合](https://kube-ovn.readthedocs.io/zh-cn/stable/en/advance/with-cilium/)することが可能です。
|
||||||
これにより、仮想マシン向けにシームレスでマルチテナントのネットワーキングを提供する統合ソリューションを実現することができます。
|
これにより、仮想マシン向けにシームレスでマルチテナントのネットワーキングを提供する統合ソリューションを実現することができます。
|
||||||
また、高度なネットワークポリシーと統合されたサービスネットワーク機能も提供されます。
|
また、高度なネットワークポリシーと統合されたサービスネットワーク機能も提供されます。
|
||||||
|
|
||||||
|
|
|
@ -1,148 +0,0 @@
|
||||||
---
|
|
||||||
title: Serviceトポロジー
|
|
||||||
feature:
|
|
||||||
title: Serviceトポロジー
|
|
||||||
description: >
|
|
||||||
Serviceのトラフィックをクラスタートポロジーに基づいてルーティングします。
|
|
||||||
content_type: concept
|
|
||||||
weight: 150
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
<!-- overview -->
|
|
||||||
|
|
||||||
{{< feature-state for_k8s_version="v1.21" state="deprecated" >}}
|
|
||||||
|
|
||||||
{{< note >}}
|
|
||||||
この機能、特にアルファ版の`topologyKeys`APIは、Kubernetes v1.21以降では非推奨です。Kubernetes v1.21で導入された、[トポロジーを意識したルーティング](/ja/docs/concepts/services-networking/topology-aware-routing/)が同様の機能を提供します。
|
|
||||||
{{</ note >}}
|
|
||||||
|
|
||||||
*Serviceトポロジー*を利用すると、Serviceのトラフィックをクラスターのノードトポロジーに基づいてルーティングできるようになります。たとえば、あるServiceのトラフィックに対して、できるだけ同じノードや同じアベイラビリティゾーン上にあるエンドポイントを優先してルーティングするように指定できます。
|
|
||||||
|
|
||||||
<!-- body -->
|
|
||||||
|
|
||||||
## はじめに
|
|
||||||
|
|
||||||
デフォルトでは、`ClusterIP`や`NodePort`Serviceに送信されたトラフィックは、Serviceに対応する任意のバックエンドのアドレスにルーティングされる可能性があります。しかし、Kubernetes 1.7以降では、「外部の」トラフィックをそのトラフィックを受信したノード上のPodにルーティングすることが可能になりました。しかし、この機能は`ClusterIP`Serviceでは対応しておらず、ゾーン内ルーティングなどのより複雑なトポロジーは実現不可能でした。*Serviceトポロジー*の機能を利用すれば、Serviceの作者が送信元ノードと送信先ノードのNodeのラベルに基づいてトラフィックをルーティングするためのポリシーを定義できるようになるため、この問題を解決できます。
|
|
||||||
|
|
||||||
送信元と送信先の間のNodeラベルのマッチングを使用することにより、オペレーターは、そのオペレーターの要件に適したメトリクスを使用して、お互いに「より近い」または「より遠い」ノードのグループを指定できます。たとえば、パブリッククラウド上のさまざまなオペレーターでは、Serviceのトラフィックを同一ゾーン内に留めようとする傾向があります。パブリッククラウドでは、ゾーンをまたぐトラフィックでは関連するコストがかかる一方、ゾーン内のトラフィックにはコストがかからない場合があるからです。その他のニーズとしては、DaemonSetが管理するローカルのPodにトラフィックをルーティングできるようにしたり、レイテンシーを低く抑えるために同じラック上のスイッチに接続されたノードにトラフィックを限定したいというものがあります。
|
|
||||||
|
|
||||||
## Serviceトポロジーを利用する
|
|
||||||
|
|
||||||
クラスターのServiceトポロジーが有効になっていれば、Serviceのspecに`topologyKeys`フィールドを指定することで、Serviceのトラフィックのルーティングを制御できます。このフィールドは、Nodeラベルの優先順位リストで、このServiceにアクセスするときにエンドポイントをソートするために使われます。トラフィックは、最初のラベルの値が送信元Nodeのものと一致するNodeに送信されます。一致したノード上にServiceに対応するバックエンドが存在しなかった場合は、2つ目のラベルについて検討が行われ、同様に、残っているラベルが順番に検討されまます。
|
|
||||||
|
|
||||||
一致するキーが1つも見つからなかった場合、トラフィックは、Serviceに対応するバックエンドが存在しなかったかのように拒否されます。言い換えると、エンドポイントは、利用可能なバックエンドが存在する最初のトポロジーキーに基づいて選択されます。このフィールドが指定され、すべてのエントリーでクライアントのトポロジーに一致するバックエンドが存在しない場合、そのクライアントに対するバックエンドが存在しないものとしてコネクションが失敗します。「任意のトポロジー」を意味する特別な値`"*"`を指定することもできます。任意の値にマッチするこの値に意味があるのは、リストの最後の値として使った場合だけです。
|
|
||||||
|
|
||||||
`topologyKeys`が未指定または空の場合、トポロジーの制約は適用されません。
|
|
||||||
|
|
||||||
ホスト名、ゾーン名、リージョン名のラベルが付いたNodeを持つクラスターについて考えてみましょう。このとき、Serviceの`topologyKeys`の値を設定することで、トラフィックの向きを以下のように制御できます。
|
|
||||||
|
|
||||||
* トラフィックを同じノード上のエンドポイントのみに向け、同じノード上にエンドポイントが1つも存在しない場合には失敗するようにする: `["kubernetes.io/hostname"]`。
|
|
||||||
* 同一ノード上のエンドポイントを優先し、失敗した場合には同一ゾーン上のエンドポイント、同一リージョンゾーンのエンドポイントへとフォールバックし、それ以外の場合には失敗する: `["kubernetes.io/hostname", "topology.kubernetes.io/zone", "topology.kubernetes.io/region"]`。これは、たとえばデータのローカリティが非常に重要である場合などに役に立ちます。
|
|
||||||
* 同一ゾーンを優先しますが、ゾーン内に利用可能なノードが存在しない場合は、利用可能な任意のエンドポイントにフォールバックする: `["topology.kubernetes.io/zone", "*"]`。
|
|
||||||
|
|
||||||
## 制約
|
|
||||||
|
|
||||||
* Serviceトポロジーは`externalTrafficPolicy=Local`と互換性がないため、Serviceは2つの機能を同時に利用できません。2つの機能を同じクラスター上の異なるServiceでそれぞれ利用することは可能ですが、同一のService上では利用できません。
|
|
||||||
|
|
||||||
* 有効なトポロジーキーは、現在は`kubernetes.io/hostname`、`topology.kubernetes.io/zone`、および`topology.kubernetes.io/region`に限定されています。しかし、将来は一般化され、他のノードラベルも使用できるようになる予定です。
|
|
||||||
|
|
||||||
* トポロジーキーは有効なラベルのキーでなければならず、最大で16個のキーまで指定できます。
|
|
||||||
|
|
||||||
* すべての値をキャッチする`"*"`を使用する場合は、トポロジーキーの最後の値として指定しなければなりません。
|
|
||||||
|
|
||||||
## 例
|
|
||||||
|
|
||||||
以下では、Serviceトポロジーの機能を利用したよくある例を紹介します。
|
|
||||||
|
|
||||||
### ノードローカルのエンドポイントだけを使用する
|
|
||||||
|
|
||||||
ノードローカルのエンドポイントのみにルーティングするServiceの例です。もし同一ノード上にエンドポイントが存在しない場合、トラフィックは損失します。
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: my-service
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: my-app
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 9376
|
|
||||||
topologyKeys:
|
|
||||||
- "kubernetes.io/hostname"
|
|
||||||
```
|
|
||||||
|
|
||||||
### ノードローカルのエンドポイントを優先して使用する
|
|
||||||
|
|
||||||
ノードローカルのエンドポイントを優先して使用しますが、ノードローカルのエンドポイントが存在しない場合にはクラスター全体のエンドポイントにフォールバックするServiceの例です。
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: my-service
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: my-app
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 9376
|
|
||||||
topologyKeys:
|
|
||||||
- "kubernetes.io/hostname"
|
|
||||||
- "*"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### 同一ゾーンや同一リージョンのエンドポイントだけを使用する
|
|
||||||
|
|
||||||
同一リージョンのエンドポイントより同一ゾーンのエンドポイントを優先するServiceの例です。もしいずれのエンドポイントも存在しない場合、トラフィックは損失します。
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: my-service
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: my-app
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 9376
|
|
||||||
topologyKeys:
|
|
||||||
- "topology.kubernetes.io/zone"
|
|
||||||
- "topology.kubernetes.io/region"
|
|
||||||
```
|
|
||||||
|
|
||||||
### ノードローカル、同一ゾーン、同一リーションのエンドポイントを優先して使用する
|
|
||||||
|
|
||||||
ノードローカル、同一ゾーン、同一リージョンのエンドポイントを順番に優先し、クラスター全体のエンドポイントにフォールバックするServiceの例です。
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: my-service
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: my-app
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 9376
|
|
||||||
topologyKeys:
|
|
||||||
- "kubernetes.io/hostname"
|
|
||||||
- "topology.kubernetes.io/zone"
|
|
||||||
- "topology.kubernetes.io/region"
|
|
||||||
- "*"
|
|
||||||
```
|
|
||||||
|
|
||||||
## {{% heading "whatsnext" %}}
|
|
||||||
|
|
||||||
* [トポロジーを意識したヒント](/ja/docs/concepts/services-networking/topology-aware-hints/)を読む。
|
|
||||||
* [サービスとアプリケーションの接続](/ja/docs/tutorials/services/connect-applications-service/)を読む。
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ weight: 20
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,6 @@ card:
|
||||||
title: Aprenda o básico
|
title: Aprenda o básico
|
||||||
---
|
---
|
||||||
|
|
||||||
{{% katacoda-removal %}}
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
|
@ -16,7 +16,7 @@ _build:
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ _build:
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ _build:
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ _build:
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
|
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
|
|
|
@ -508,6 +508,16 @@ Taint Manager(`kube-controller-manager` 中节点生命周期控制器的一
|
||||||
由于{{<glossary_tooltip term_id="node-pressure-eviction" text="节点压力驱逐">}}或[节点体面关闭](/zh-cn/docs/concepts/architecture/nodes/#graceful-node-shutdown)而被
|
由于{{<glossary_tooltip term_id="node-pressure-eviction" text="节点压力驱逐">}}或[节点体面关闭](/zh-cn/docs/concepts/architecture/nodes/#graceful-node-shutdown)而被
|
||||||
kubelet 终止。
|
kubelet 终止。
|
||||||
|
|
||||||
|
<!--
|
||||||
|
In all other disruption scenarios, like eviction due to exceeding
|
||||||
|
[Pod container limits](/docs/concepts/configuration/manage-resources-containers/),
|
||||||
|
Pods don't receive the `DisruptionTarget` condition because the disruptions were
|
||||||
|
probably caused by the Pod and would reoccur on retry.
|
||||||
|
-->
|
||||||
|
在所有其他中断场景中,例如由于超出
|
||||||
|
[Pod 容器限制]而被驱逐,`DisruptionTarget` 状况不会被添加到 Pod 上,
|
||||||
|
因为中断可能是由 Pod 引起的,并且会在重试时再次发生。
|
||||||
|
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
<!--
|
<!--
|
||||||
A Pod disruption might be interrupted. The control plane might re-attempt to
|
A Pod disruption might be interrupted. The control plane might re-attempt to
|
||||||
|
|
|
@ -23,8 +23,8 @@ application more available despite bugs.
|
||||||
-->
|
-->
|
||||||
这篇文章介绍如何给容器配置存活(Liveness)、就绪(Readiness)和启动(Startup)探针。
|
这篇文章介绍如何给容器配置存活(Liveness)、就绪(Readiness)和启动(Startup)探针。
|
||||||
|
|
||||||
有关探针的更多信息,请参阅
|
有关探针的更多信息,
|
||||||
[Liveness、Readiness 和 Startup 探针](/zh-cn/docs/concepts/configuration/liveness-readiness-startup-probes)。
|
请参阅[存活、就绪和启动探针](/zh-cn/docs/concepts/configuration/liveness-readiness-startup-probes)。
|
||||||
|
|
||||||
[kubelet](/zh-cn/docs/reference/command-line-tools-reference/kubelet/)
|
[kubelet](/zh-cn/docs/reference/command-line-tools-reference/kubelet/)
|
||||||
使用存活探针来确定什么时候要重启容器。
|
使用存活探针来确定什么时候要重启容器。
|
||||||
|
@ -291,7 +291,7 @@ checks will fail, and the kubelet will kill and restart the container.
|
||||||
|
|
||||||
To try the HTTP liveness check, create a Pod:
|
To try the HTTP liveness check, create a Pod:
|
||||||
-->
|
-->
|
||||||
kubelet 在容器启动之后 3 秒开始执行健康检测。所以前几次健康检查都是成功的。
|
kubelet 在容器启动之后 3 秒开始执行健康检查。所以前几次健康检查都是成功的。
|
||||||
但是 10 秒之后,健康检查会失败,并且 kubelet 会杀死容器再重新启动容器。
|
但是 10 秒之后,健康检查会失败,并且 kubelet 会杀死容器再重新启动容器。
|
||||||
|
|
||||||
创建一个 Pod 来测试 HTTP 的存活检测:
|
创建一个 Pod 来测试 HTTP 的存活检测:
|
||||||
|
@ -334,29 +334,34 @@ can't it is considered a failure.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
As you can see, configuration for a TCP check is quite similar to an HTTP check.
|
As you can see, configuration for a TCP check is quite similar to an HTTP check.
|
||||||
This example uses both readiness and liveness probes. The kubelet will send the
|
This example uses both readiness and liveness probes. The kubelet will run the
|
||||||
first readiness probe 15 seconds after the container starts. This will attempt to
|
first liveness probe 15 seconds after the container starts. This will attempt to
|
||||||
connect to the `goproxy` container on port 8080. If the probe succeeds, the Pod
|
connect to the `goproxy` container on port 8080. If the liveness probe fails,
|
||||||
will be marked as ready. The kubelet will continue to run this check every 10
|
the container will be restarted. The kubelet will continue to run this check
|
||||||
seconds.
|
every 10 seconds.
|
||||||
|
-->
|
||||||
|
如你所见,TCP 检测的配置和 HTTP 检测非常相似。
|
||||||
|
下面这个例子同时使用就绪探针和存活探针。kubelet 会在容器启动 15 秒后运行第一次存活探测。
|
||||||
|
此探测会尝试连接 `goproxy` 容器的 8080 端口。
|
||||||
|
如果此存活探测失败,容器将被重启。kubelet 将继续每隔 10 秒运行一次这种探测。
|
||||||
|
|
||||||
In addition to the readiness probe, this configuration includes a liveness probe.
|
<!--
|
||||||
The kubelet will run the first liveness probe 15 seconds after the container
|
In addition to the liveness probe, this configuration includes a readiness
|
||||||
starts. Similar to the readiness probe, this will attempt to connect to the
|
probe. The kubelet will run the first readiness probe 15 seconds after the
|
||||||
`goproxy` container on port 8080. If the liveness probe fails, the container
|
container starts. Similar to the liveness probe, this will attempt to connect to
|
||||||
will be restarted.
|
the `goproxy` container on port 8080. If the probe succeeds, the Pod will be
|
||||||
|
marked as ready and will receive traffic from services. If the readiness probe
|
||||||
|
fails, the pod will be marked unready and will not receive traffic from any
|
||||||
|
services.
|
||||||
|
|
||||||
To try the TCP liveness check, create a Pod:
|
To try the TCP liveness check, create a Pod:
|
||||||
-->
|
-->
|
||||||
如你所见,TCP 检测的配置和 HTTP 检测非常相似。
|
除了存活探针,这个配置还包括一个就绪探针。
|
||||||
下面这个例子同时使用就绪和存活探针。kubelet 会在容器启动 15 秒后发送第一个就绪探针。
|
kubelet 会在容器启动 15 秒后运行第一次就绪探测。
|
||||||
探针会尝试连接 `goproxy` 容器的 8080 端口。
|
与存活探测类似,就绪探测会尝试连接 `goproxy` 容器的 8080 端口。
|
||||||
如果探测成功,这个 Pod 会被标记为就绪状态,kubelet 将继续每隔 10 秒运行一次探测。
|
如果就绪探测失败,Pod 将被标记为未就绪,且不会接收来自任何服务的流量。
|
||||||
|
|
||||||
除了就绪探针,这个配置包括了一个存活探针。
|
要尝试 TCP 存活检测,运行以下命令创建 Pod:
|
||||||
kubelet 会在容器启动 15 秒后进行第一次存活探测。
|
|
||||||
与就绪探针类似,存活探针会尝试连接 `goproxy` 容器的 8080 端口。
|
|
||||||
如果存活探测失败,容器会被重新启动。
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml
|
kubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml
|
||||||
|
@ -365,7 +370,7 @@ kubectl apply -f https://k8s.io/examples/pods/probe/tcp-liveness-readiness.yaml
|
||||||
<!--
|
<!--
|
||||||
After 15 seconds, view Pod events to verify that liveness probes:
|
After 15 seconds, view Pod events to verify that liveness probes:
|
||||||
-->
|
-->
|
||||||
15 秒之后,通过看 Pod 事件来检测存活探针:
|
15 秒之后,通过查看 Pod 事件来检测存活探针:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl describe pod goproxy
|
kubectl describe pod goproxy
|
||||||
|
@ -388,11 +393,6 @@ Here is an example manifest:
|
||||||
-->
|
-->
|
||||||
如果你的应用实现了
|
如果你的应用实现了
|
||||||
[gRPC 健康检查协议](https://github.com/grpc/grpc/blob/master/doc/health-checking.md),
|
[gRPC 健康检查协议](https://github.com/grpc/grpc/blob/master/doc/health-checking.md),
|
||||||
kubelet 可以配置为使用该协议来执行应用存活性检查。
|
|
||||||
你必须启用 `GRPCContainerProbe`
|
|
||||||
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
|
|
||||||
才能配置依赖于 gRPC 的检查机制。
|
|
||||||
|
|
||||||
这个例子展示了如何配置 Kubernetes 以将其用于应用的存活性检查。
|
这个例子展示了如何配置 Kubernetes 以将其用于应用的存活性检查。
|
||||||
类似地,你可以配置就绪探针和启动探针。
|
类似地,你可以配置就绪探针和启动探针。
|
||||||
|
|
||||||
|
@ -422,10 +422,10 @@ those. For example: `myservice-liveness` (using `-` as a separator).
|
||||||
|
|
||||||
{{< note >}}
|
{{< note >}}
|
||||||
<!--
|
<!--
|
||||||
Unlike HTTP and TCP probes, you cannot specify the health check port by name, and you
|
Unlike HTTP or TCP probes, you cannot specify the health check port by name, and you
|
||||||
cannot configure a custom hostname.
|
cannot configure a custom hostname.
|
||||||
-->
|
-->
|
||||||
与 HTTP 和 TCP 探针不同,gRPC 探测不能使用按名称指定端口,
|
与 HTTP 或 TCP 探针不同,gRPC 探测不能按名称指定健康检查端口,
|
||||||
也不能自定义主机名。
|
也不能自定义主机名。
|
||||||
{{< /note >}}
|
{{< /note >}}
|
||||||
|
|
||||||
|
@ -501,21 +501,20 @@ livenessProbe:
|
||||||
<!--
|
<!--
|
||||||
## Protect slow starting containers with startup probes {#define-startup-probes}
|
## Protect slow starting containers with startup probes {#define-startup-probes}
|
||||||
|
|
||||||
Sometimes, you have to deal with legacy applications that might require
|
Sometimes, you have to deal with applications that require additional startup
|
||||||
an additional startup time on their first initialization.
|
time on their first initialization. In such cases, it can be tricky to set up
|
||||||
In such cases, it can be tricky to set up liveness probe parameters without
|
liveness probe parameters without compromising the fast response to deadlocks
|
||||||
compromising the fast response to deadlocks that motivated such a probe.
|
that motivated such a probe. The solution is to set up a startup probe with the
|
||||||
The trick is to set up a startup probe with the same command, HTTP or TCP
|
same command, HTTP or TCP check, with a `failureThreshold * periodSeconds` long
|
||||||
check, with a `failureThreshold * periodSeconds` long enough to cover the
|
enough to cover the worst case startup time.
|
||||||
worst case startup time.
|
|
||||||
|
|
||||||
So, the previous example would become:
|
So, the previous example would become:
|
||||||
-->
|
-->
|
||||||
## 使用启动探针保护慢启动容器 {#define-startup-probes}
|
## 使用启动探针保护慢启动容器 {#define-startup-probes}
|
||||||
|
|
||||||
有时候,会有一些现有的应用在启动时需要较长的初始化时间。
|
有时候,会有一些现有的应用在启动时需要较长的初始化时间。
|
||||||
要这种情况下,若要不影响对死锁作出快速响应的探测,设置存活探测参数是要技巧的。
|
在这种情况下,若要不影响对死锁作出快速响应的探测,设置存活探测参数是要技巧的。
|
||||||
技巧就是使用相同的命令来设置启动探测,针对 HTTP 或 TCP 检测,可以通过将
|
解决办法是使用相同的命令来设置启动探测,针对 HTTP 或 TCP 检测,可以通过将
|
||||||
`failureThreshold * periodSeconds` 参数设置为足够长的时间来应对最糟糕情况下的启动时间。
|
`failureThreshold * periodSeconds` 参数设置为足够长的时间来应对最糟糕情况下的启动时间。
|
||||||
|
|
||||||
这样,前面的例子就变成了:
|
这样,前面的例子就变成了:
|
||||||
|
@ -639,7 +638,7 @@ liveness and readiness checks:
|
||||||
* `initialDelaySeconds`: Number of seconds after the container has started before startup,
|
* `initialDelaySeconds`: Number of seconds after the container has started before startup,
|
||||||
liveness or readiness probes are initiated. If a startup probe is defined, liveness and
|
liveness or readiness probes are initiated. If a startup probe is defined, liveness and
|
||||||
readiness probe delays do not begin until the startup probe has succeeded. If the value of
|
readiness probe delays do not begin until the startup probe has succeeded. If the value of
|
||||||
`periodSeconds` is greater than `initialDelaySeconds` then the `initialDelaySeconds` would be
|
`periodSeconds` is greater than `initialDelaySeconds` then the `initialDelaySeconds` will be
|
||||||
ignored. Defaults to 0 seconds. Minimum value is 0.
|
ignored. Defaults to 0 seconds. Minimum value is 0.
|
||||||
* `periodSeconds`: How often (in seconds) to perform the probe. Default to 10 seconds.
|
* `periodSeconds`: How often (in seconds) to perform the probe. Default to 10 seconds.
|
||||||
The minimum value is 1.
|
The minimum value is 1.
|
||||||
|
@ -878,6 +877,28 @@ For example:
|
||||||
-->
|
-->
|
||||||
例如:
|
例如:
|
||||||
|
|
||||||
|
<!--
|
||||||
|
```yaml
|
||||||
|
spec:
|
||||||
|
terminationGracePeriodSeconds: 3600 # pod-level
|
||||||
|
containers:
|
||||||
|
- name: test
|
||||||
|
image: ...
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- name: liveness-port
|
||||||
|
containerPort: 8080
|
||||||
|
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /healthz
|
||||||
|
port: liveness-port
|
||||||
|
failureThreshold: 1
|
||||||
|
periodSeconds: 60
|
||||||
|
# Override pod-level terminationGracePeriodSeconds #
|
||||||
|
terminationGracePeriodSeconds: 60
|
||||||
|
```
|
||||||
|
-->
|
||||||
```yaml
|
```yaml
|
||||||
spec:
|
spec:
|
||||||
terminationGracePeriodSeconds: 3600 # Pod 级别设置
|
terminationGracePeriodSeconds: 3600 # Pod 级别设置
|
||||||
|
|
|
@ -9,8 +9,6 @@ card:
|
||||||
title: 基础知识介绍
|
title: 基础知识介绍
|
||||||
---
|
---
|
||||||
|
|
||||||
{{% katacoda-removal %}}
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html lang="zh">
|
<html lang="zh">
|
||||||
|
|
|
@ -18,7 +18,7 @@ weight: 20
|
||||||
|
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/styles.css" rel="stylesheet">
|
||||||
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
<link href="/docs/tutorials/kubernetes-basics/public/css/overrides.css" rel="stylesheet">
|
||||||
<script src="https://katacoda.com/embed.js"></script>
|
{{< katacoda-tutorial >}}
|
||||||
<div class="layout" id="top">
|
<div class="layout" id="top">
|
||||||
|
|
||||||
<main class="content katacoda-content">
|
<main class="content katacoda-content">
|
||||||
|
|
|
@ -19,4 +19,4 @@ spec:
|
||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: 8080
|
port: 8080
|
||||||
initialDelaySeconds: 15
|
initialDelaySeconds: 15
|
||||||
periodSeconds: 20
|
periodSeconds: 10
|
||||||
|
|
|
@ -211,17 +211,16 @@ other = "JavaScript must be [enabled](https://www.enable-javascript.com/) to vie
|
||||||
|
|
||||||
[katacoda_message]
|
[katacoda_message]
|
||||||
other = """<h4>Shutdown of interactive tutorials</h4>
|
other = """<h4>Shutdown of interactive tutorials</h4>
|
||||||
<p>The interactive tutorials on this website are being shut down. The Kubernetes
|
<p>The interactive tutorials previously on this website have been shut down.</p>
|
||||||
project hopes to reinstate a similar interactive learning option in the long
|
|
||||||
term.</p>
|
|
||||||
<p>The shutdown follows O'Reilly Media's 2019 <a
|
|
||||||
href="https://www.oreilly.com/content/oreilly-acquires-katacoda-and-a-new-way-for-2-5m-customers-to-learn/">acquisition</a>
|
|
||||||
of Katacoda.</p>
|
|
||||||
<p>Kubernetes is grateful to O'Reilly and Katacoda for many years of helping
|
<p>Kubernetes is grateful to O'Reilly and Katacoda for many years of helping
|
||||||
people take their first steps in learning Kubernetes.</p>
|
people take their first steps in learning Kubernetes.</p>
|
||||||
<p>The tutorials will cease to function after the <b>31<sup>st</sup> of March,
|
<p>The shutdown followed O'Reilly Media's 2019
|
||||||
2023</b>. For more information, see "<a href="/blog/2023/02/14/kubernetes-katacoda-tutorials-stop-from-2023-03-31/">Free Katacoda Kubernetes Tutorials Are Shutting
|
<a href="https://www.oreilly.com/content/oreilly-acquires-katacoda-and-a-new-way-for-2-5m-customers-to-learn/">acquisition</a>
|
||||||
Down</a>."</p>"""
|
of Katacoda.</p>
|
||||||
|
<hr />
|
||||||
|
<p>The tutorials ceased to function after the <b>31<sup>st</sup> of March,
|
||||||
|
2023</b>. You are seeing this notice because this particular page has not yet been updated
|
||||||
|
following that shutdown.</p>"""
|
||||||
|
|
||||||
[latest_release]
|
[latest_release]
|
||||||
other = "Latest Release:"
|
other = "Latest Release:"
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class="td-content">
|
<div class="td-content">
|
||||||
|
{{- if .HasShortcode "kat-button" -}}
|
||||||
|
<div class="pageinfo pageinfo-secondary">
|
||||||
|
{{ T "katacoda_message" | safeHTML }}
|
||||||
|
</div>
|
||||||
|
{{- end -}}
|
||||||
{{ partial "docs/content-page" (dict "ctx" . "page" .) }}
|
{{ partial "docs/content-page" (dict "ctx" . "page" .) }}
|
||||||
<!-- Partial "docs/api-reference-links" determines API reference links for 'partial/page-meta-links.html' -->
|
<!-- Partial "docs/api-reference-links" determines API reference links for 'partial/page-meta-links.html' -->
|
||||||
{{ partial "docs/api-reference-links" . }}
|
{{ partial "docs/api-reference-links" . }}
|
||||||
|
|
|
@ -86,11 +86,6 @@
|
||||||
<!--Script for dismissing banners/notices-->
|
<!--Script for dismissing banners/notices-->
|
||||||
<script defer src="{{ "js/dismiss_banner.js" | relURL }}"></script>
|
<script defer src="{{ "js/dismiss_banner.js" | relURL }}"></script>
|
||||||
|
|
||||||
|
|
||||||
{{- if .HasShortcode "release-binaries" -}}
|
|
||||||
<script defer src="{{ "js/release_binaries.js" | relURL }}"></script>
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- if eq (lower .Params.cid) "community" -}}
|
{{- if eq (lower .Params.cid) "community" -}}
|
||||||
{{- if eq .Params.community_styles_migrated true -}}
|
{{- if eq .Params.community_styles_migrated true -}}
|
||||||
<link href="/css/community.css" rel="stylesheet"><!-- legacy styles -->
|
<link href="/css/community.css" rel="stylesheet"><!-- legacy styles -->
|
||||||
|
|
|
@ -31,4 +31,14 @@
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- errorf "Unable to find the glossary helper script" -}}
|
{{- errorf "Unable to find the glossary helper script" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- if .HasShortcode "release-binaries" -}}
|
||||||
|
{{- if hugo.IsProduction -}}
|
||||||
|
{{- $releaseBinariesJs := resources.Get "js/release_binaries.js" | minify | fingerprint -}}
|
||||||
|
<script defer src="{{ $releaseBinariesJs.RelPermalink }}" integrity="{{ $releaseBinariesJs.Data.Integrity }}" crossorigin="anonymous"></script>
|
||||||
|
{{- else -}}
|
||||||
|
{{- $releaseBinariesJs := resources.Get "js/release_binaries.js" -}}
|
||||||
|
<script defer src="{{ $releaseBinariesJs.RelPermalink }}"></script>
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
|
@ -1,2 +0,0 @@
|
||||||
<script defer src="https://katacoda.com/embed.js"></script>
|
|
||||||
<button class="button" onclick="window.katacoda.init(); ">Launch Terminal</button>
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
{{/* placeholder */}}
|
||||||
|
{{/* See https://k8s.io/blog/2023/02/14/kubernetes-katacoda-tutorials-stop-from-2023-03-31/ */}}
|
|
@ -1,3 +0,0 @@
|
||||||
<div class="pageinfo pageinfo-secondary">
|
|
||||||
{{ T "katacoda_message" | safeHTML }}
|
|
||||||
</div>
|
|
|
@ -1 +1,2 @@
|
||||||
<script defer src="https://katacoda.com/embed.js"></script>
|
{{/* placeholder */}}
|
||||||
|
{{/* See https://k8s.io/blog/2023/02/14/kubernetes-katacoda-tutorials-stop-from-2023-03-31/ */}}
|
||||||
|
|
Loading…
Reference in New Issue