Skip to content

Commit e15b943

Browse files
authored
install-kubectl-linux.md: add chmods
The keyring needs to be readable by _apt, otherwise "apt update" prints the following kind of error: W: GPG error: https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.29/deb InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 234654DA9A296436 E: The repository 'https://pkgs.k8s.io/core:/stable:/v1.29/deb InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. kubernetes.list needs to be world-readable, otherwise command-not-found prints warnings such as: WARNING:root:could not open file '/etc/apt/sources.list.d/kubernetes.list'
1 parent 7759525 commit e15b943

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/en/docs/tasks/tools/install-kubectl-linux.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ The following methods exist for installing kubectl on Linux:
137137

138138
```shell
139139
curl -fsSL https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
140+
sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg # Needed so that _apt user can read it
140141
```
141142

142143
3. Add the appropriate Kubernetes `apt` repository. If you want to use Kubernetes version different than {{< param "version" >}},
@@ -145,6 +146,7 @@ The following methods exist for installing kubectl on Linux:
145146
```shell
146147
# This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list
147148
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/{{< param "version" >}}/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
149+
sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list # Needed so that command-not-found works correctly
148150
```
149151

150152
{{< note >}}

0 commit comments

Comments
 (0)