first translations
This commit is contained in:
parent
7d6f179010
commit
fe55eb7f8d
|
|
@ -0,0 +1,286 @@
|
|||
---
|
||||
title: Kubectl installieren und konfigurieren auf macOS
|
||||
content_type: task
|
||||
weight: 10
|
||||
card:
|
||||
name: tasks
|
||||
weight: 20
|
||||
title: Kubectl auf macOS installieren
|
||||
---
|
||||
|
||||
## {{% heading "prerequisites" %}}
|
||||
|
||||
Sie müssen eine kubectl-Version verwenden, welche nicht mehr als eine Minor-Version Unterschied zu ihrem Cluster aufweist. Zum Beispiel: eine Client-Version v{{< skew currentVersion >}} kann mit folgenden versionen kommunizieren v{{< skew currentVersionAddMinor -1 >}}, v{{< skew currentVersionAddMinor 0 >}}, und v{{< skew currentVersionAddMinor 1 >}}.
|
||||
Die Verwendung der neuesten kompatiblen Version von kubectl hilft, unvorhergesehene Probleme zu vermeiden.
|
||||
|
||||
## Kubectl auf macOS installieren
|
||||
|
||||
Um kubectl auf macOS zu installieren, gibt es die folgenden Möglichkeiten:
|
||||
|
||||
- [{{% heading "prerequisites" %}}](#-heading-prerequisites-)
|
||||
- [Kubectl auf macOS installieren](#kubectl-auf-macos-installieren)
|
||||
- [Kubectl Binary mit curl auf macOS installieren](#kubectl-binary-mit-curl-auf-macos-installieren)
|
||||
- [Mit Homebrew auf macOS installieren](#mit-homebrew-auf-macos-installieren)
|
||||
- [Install with Macports on macOS](#install-with-macports-on-macos)
|
||||
- [Kubectl Konfiguration verifizieren](#kubectl-konfiguration-verifizieren)
|
||||
- [Optionale kubectl Konfigurationen und Plugins](#optionale-kubectl-konfigurationen-und-plugins)
|
||||
- [Shell Autovervollständigung einbinden](#shell-autovervollständigung-einbinden)
|
||||
- [`kubectl convert` Plugin intallieren](#kubectl-convert-plugin-intallieren)
|
||||
- [{{% heading "whatsnext" %}}](#-heading-whatsnext-)
|
||||
|
||||
### Kubectl Binary mit curl auf macOS installieren
|
||||
|
||||
1. Das aktuellste Release downloaden:
|
||||
|
||||
{{< 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 >}}
|
||||
Um eine spezifische Version herunterzuladen, ersetzen sie `$(curl -L -s https://dl.k8s.io/release/stable.txt)` mit der spezifischen Version
|
||||
|
||||
Um zum Beispiel Version {{< param "fullversion" >}} auf Intel macOS herunterzuladen:
|
||||
|
||||
```bash
|
||||
curl -LO "https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/darwin/amd64/kubectl"
|
||||
```
|
||||
|
||||
Für macOS auf Apple Silicon (z.B. M1/M2):
|
||||
|
||||
```bash
|
||||
curl -LO "https://dl.k8s.io/release/{{< param "fullversion" >}}/bin/darwin/arm64/kubectl"
|
||||
```
|
||||
|
||||
{{< /note >}}
|
||||
|
||||
2. Binary validieren (optional)
|
||||
|
||||
Downloaden die die kubectl Checksum-Datei:
|
||||
|
||||
{{< 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 >}}
|
||||
|
||||
Validieren Sie die Kubectl Binary mit der Checksum-Datei:
|
||||
|
||||
```bash
|
||||
echo "$(cat kubectl.sha256) kubectl" | shasum -a 256 --check
|
||||
```
|
||||
|
||||
Wenn Valide, dann sieht die Ausgabe wie folgt aus:
|
||||
|
||||
```console
|
||||
kubectl: OK
|
||||
```
|
||||
|
||||
Falls die Validierung fehlschlägt, beendet sich `shasum` mit einem "nonzero"-Status und gibt einen Fehler aus, welcher so aussehen könnte:
|
||||
|
||||
```bash
|
||||
kubectl: FAILED
|
||||
shasum: WARNING: 1 computed checksum did NOT match
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
Laden sie von der Binary und Checksum-Datei immer die selben Versionen herunter.
|
||||
{{< /note >}}
|
||||
|
||||
3. Kubectl Binary ausführbar machen.
|
||||
|
||||
```bash
|
||||
chmod +x ./kubectl
|
||||
```
|
||||
|
||||
4. Kubectl Binary zu einem Ordner in ihrem `PATH` verschieben.
|
||||
|
||||
```bash
|
||||
sudo mv ./kubectl /usr/local/bin/kubectl
|
||||
sudo chown root: /usr/local/bin/kubectl
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
Stellen Sie sicher, dass `/usr/local/bin` in ihrer PATH Umgebungsvariable gesetzt ist.
|
||||
{{< /note >}}
|
||||
|
||||
5. Prüfen ob die installierte Version die aktuellste Version ist:
|
||||
|
||||
```bash
|
||||
kubectl version --client
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
Der oben stehende Befehl wirft folgende Warnung:
|
||||
|
||||
```
|
||||
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.
|
||||
```
|
||||
|
||||
Sie können diese Warnung ignorieren. Sie prüfen lediglich die `kubectl` Version welche sie installiert haben.
|
||||
|
||||
{{< /note >}}
|
||||
|
||||
Oder benutzten sie diesen Befehl für einer detailliertere Ansicht:
|
||||
|
||||
```cmd
|
||||
kubectl version --client --output=yaml
|
||||
```
|
||||
|
||||
6. Nach Installation des Plugins, die installations Dateien aufräumen:
|
||||
|
||||
```bash
|
||||
rm kubectl kubectl.sha256
|
||||
```
|
||||
|
||||
### Mit Homebrew auf macOS installieren
|
||||
|
||||
Wenn Sie macOS und [Homebrew](https://brew.sh/) als Paketmanager benutzen,
|
||||
können Sie kubectl über diesen installieren.
|
||||
|
||||
1. Führen Sie den Installationsbefehl aus:
|
||||
|
||||
```bash
|
||||
brew install kubectl
|
||||
```
|
||||
|
||||
oder
|
||||
|
||||
```bash
|
||||
brew install kubernetes-cli
|
||||
```
|
||||
|
||||
2. Prüfen ob die installierte Version die aktuellste Version ist:
|
||||
|
||||
```bash
|
||||
kubectl version --client
|
||||
```
|
||||
|
||||
### Install with Macports on macOS
|
||||
|
||||
Wenn Sie macOS und [Macports](https://macports.org/) als Paketmanager benutzen, können Sie kubectl über diesen installieren.
|
||||
|
||||
1. Führen Sie den Installationsbefehl aus:
|
||||
|
||||
```bash
|
||||
sudo port selfupdate
|
||||
sudo port install kubectl
|
||||
```
|
||||
|
||||
1. Prüfen ob die installierte Version die aktuellste Version ist:
|
||||
|
||||
```bash
|
||||
kubectl version --client
|
||||
```
|
||||
|
||||
## Kubectl Konfiguration verifizieren
|
||||
|
||||
{{< include "included/verify-kubectl.md" >}}
|
||||
|
||||
## Optionale kubectl Konfigurationen und Plugins
|
||||
|
||||
### Shell Autovervollständigung einbinden
|
||||
|
||||
kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell
|
||||
which can save you a lot of typing.
|
||||
|
||||
Below are the procedures to set up autocompletion for Bash, Fish, and 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 >}}
|
||||
|
||||
### `kubectl convert` Plugin intallieren
|
||||
|
||||
{{< include "included/kubectl-convert-overview.md" >}}
|
||||
|
||||
1. Download the latest release with the command:
|
||||
|
||||
{{< 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. Validate the binary (optional)
|
||||
|
||||
Download the kubectl-convert checksum file:
|
||||
|
||||
{{< 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 >}}
|
||||
|
||||
Validate the kubectl-convert binary against the checksum file:
|
||||
|
||||
```bash
|
||||
echo "$(cat kubectl-convert.sha256) kubectl-convert" | shasum -a 256 --check
|
||||
```
|
||||
|
||||
If valid, the output is:
|
||||
|
||||
```console
|
||||
kubectl-convert: OK
|
||||
```
|
||||
|
||||
If the check fails, `shasum` exits with nonzero status and prints output similar to:
|
||||
|
||||
```bash
|
||||
kubectl-convert: FAILED
|
||||
shasum: WARNING: 1 computed checksum did NOT match
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
Download the same version of the binary and checksum.
|
||||
{{< /note >}}
|
||||
|
||||
1. Make kubectl-convert binary executable
|
||||
|
||||
```bash
|
||||
chmod +x ./kubectl-convert
|
||||
```
|
||||
|
||||
1. Move the kubectl-convert binary to a file location on your system `PATH`.
|
||||
|
||||
```bash
|
||||
sudo mv ./kubectl-convert /usr/local/bin/kubectl-convert
|
||||
sudo chown root: /usr/local/bin/kubectl-convert
|
||||
```
|
||||
|
||||
{{< note >}}
|
||||
Make sure `/usr/local/bin` is in your PATH environment variable.
|
||||
{{< /note >}}
|
||||
|
||||
1. Verify plugin is successfully installed
|
||||
|
||||
```shell
|
||||
kubectl convert --help
|
||||
```
|
||||
|
||||
If you do not see an error, it means the plugin is successfully installed.
|
||||
|
||||
1. After installing the plugin, clean up the installation files:
|
||||
|
||||
```bash
|
||||
rm kubectl-convert kubectl-convert.sha256
|
||||
```
|
||||
|
||||
## {{% heading "whatsnext" %}}
|
||||
|
||||
{{< include "included/kubectl-whats-next.md" >}}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: "What's next?"
|
||||
description: "What's next after installing kubectl."
|
||||
headless: true
|
||||
_build:
|
||||
list: never
|
||||
render: never
|
||||
publishResources: false
|
||||
---
|
||||
|
||||
* [Minikube installieren](https://minikube.sigs.k8s.io/docs/start/)
|
||||
* See the [Setup Guides](/docs/setup/) for more about creating clusters.
|
||||
* [Learn how to launch and expose your application.](/docs/tasks/access-application-cluster/service-access-application-cluster/)
|
||||
* If you need access to a cluster you didn't create, see the
|
||||
[Sharing Cluster Access document](/docs/tasks/access-application-cluster/configure-access-multiple-clusters/).
|
||||
* Read the [kubectl reference docs](/docs/reference/kubectl/kubectl/)
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: "verify kubectl install"
|
||||
description: "How to verify kubectl."
|
||||
headless: true
|
||||
_build:
|
||||
list: never
|
||||
render: never
|
||||
publishResources: false
|
||||
---
|
||||
|
||||
In order for kubectl to find and access a Kubernetes cluster, it needs a
|
||||
[kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/),
|
||||
which is created automatically when you create a cluster using
|
||||
[kube-up.sh](https://github.com/kubernetes/kubernetes/blob/master/cluster/kube-up.sh)
|
||||
or successfully deploy a Minikube cluster.
|
||||
By default, kubectl configuration is located at `~/.kube/config`.
|
||||
|
||||
Check that kubectl is properly configured by getting the cluster state:
|
||||
|
||||
```shell
|
||||
kubectl cluster-info
|
||||
```
|
||||
|
||||
If you see a URL response, kubectl is correctly configured to access your cluster.
|
||||
|
||||
If you see a message similar to the following, kubectl is not configured correctly or is not able to connect to a Kubernetes cluster.
|
||||
|
||||
```
|
||||
The connection to the server <server-name:port> was refused - did you specify the right host or port?
|
||||
```
|
||||
|
||||
For example, if you are intending to run a Kubernetes cluster on your laptop (locally), you will need a tool like Minikube to be installed first and then re-run the commands stated above.
|
||||
|
||||
If kubectl cluster-info returns the url response but you can't access your cluster, to check whether it is configured properly, use:
|
||||
|
||||
```shell
|
||||
kubectl cluster-info dump
|
||||
```
|
||||
Loading…
Reference in New Issue