From 09e79db50630c859a8eafcf02f16e5cb3f477430 Mon Sep 17 00:00:00 2001 From: Christine K <125943705+karistom@users.noreply.github.com> Date: Thu, 18 Jan 2024 03:01:14 +1100 Subject: [PATCH] Add example command to create /etc/apt/keyrings directory (#43626) * create folder for key The following command will fail without the folder created manually beforhand. ``` curl -fsSL https://dl.k8s.io/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg ``` * updated instruction updated according to the comment in the PR * updated mkdir part * Updated mkdir --- .../tools/kubeadm/install-kubeadm.md | 6 ++++++ content/en/docs/tasks/tools/install-kubectl-linux.md | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/content/en/docs/setup/production-environment/tools/kubeadm/install-kubeadm.md b/content/en/docs/setup/production-environment/tools/kubeadm/install-kubeadm.md index 11f0d10951..8690c95101 100644 --- a/content/en/docs/setup/production-environment/tools/kubeadm/install-kubeadm.md +++ b/content/en/docs/setup/production-environment/tools/kubeadm/install-kubeadm.md @@ -182,8 +182,14 @@ These instructions are for Kubernetes {{< skew currentVersion >}}. The same signing key is used for all repositories so you can disregard the version in the URL: ```shell + # If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below. + # sudo mkdir -p -m 755 /etc/apt/keyrings curl -fsSL https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg ``` + +{{< note >}} +In releases older than Debian 12 and Ubuntu 22.04, folder `/etc/apt/keyrings` does not exist by default, and it should be created before the curl command. +{{< /note >}} {{< note >}} In releases older than Debian 12 and Ubuntu 22.04, `/etc/apt/keyrings` does not exist by default; diff --git a/content/en/docs/tasks/tools/install-kubectl-linux.md b/content/en/docs/tasks/tools/install-kubectl-linux.md index ef7a87889a..1e91727a4a 100644 --- a/content/en/docs/tasks/tools/install-kubectl-linux.md +++ b/content/en/docs/tasks/tools/install-kubectl-linux.md @@ -136,8 +136,14 @@ The following methods exist for installing kubectl on Linux: 2. Download the public signing key for the Kubernetes package repositories. The same signing key is used for all repositories so you can disregard the version in the URL: ```shell + # If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below. + # sudo mkdir -p -m 755 /etc/apt/keyrings curl -fsSL https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg ``` + +{{< note >}} +In releases older than Debian 12 and Ubuntu 22.04, folder `/etc/apt/keyrings` does not exist by default, and it should be created before the curl command. +{{< /note >}} 3. Add the appropriate Kubernetes `apt` repository. If you want to use Kubernetes version different than {{< param "version" >}}, replace {{< param "version" >}} with the desired minor version in the command below: @@ -158,10 +164,6 @@ To upgrade kubectl to another minor release, you'll need to bump the version in sudo apt-get install -y kubectl ``` -{{< note >}} -In releases older than Debian 12 and Ubuntu 22.04, `/etc/apt/keyrings` does not exist by default, and can be created using `sudo mkdir -m 755 /etc/apt/keyrings` -{{< /note >}} - {{% /tab %}} {{% tab name="Red Hat-based distributions" %}}