I'm trying to configure an Ubuntu 18.04 using Puppet as a Kubernetes master. There's a puppet manifest on puppet master which defines the required configurations to install the kublet, kubeadm, and kubectl packages on the Ubuntu server, where i am trying to add the kubernetes repo using apt module of puppet.
sudo puppet agent -t
Here's the output.
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for buildserver.mycompany.com
Info: Applying configuration version '1549042128'
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install kubelet' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package kubelet
Error: /Stage[main]/Kubernetes/Package[kubelet]/ensure: change from 'purged' to 'present' failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install kubelet' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package kubelet
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install kubeadm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package kubeadm
Error: /Stage[main]/Kubernetes/Package[kubeadm]/ensure: change from 'purged' to 'present' failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install kubeadm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package kubeadm
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install kubectl' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package kubectl
Error: /Stage[main]/Kubernetes/Package[kubectl]/ensure: change from 'purged' to 'present' failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install kubectl' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package kubectl
Notice: /Stage[main]/Kubernetes/Apt::Source[kubernetes]/Apt::Setting[list-kubernetes]/File[/etc/apt/sources.list.d/kubernetes.list]/ensure: defined content as '{md5}a0ab4048dbab52eed3aa72b3b6b533cf'
Info: /Stage[main]/Kubernetes/Apt::Source[kubernetes]/Apt::Setting[list-kubernetes]/File[/etc/apt/sources.list.d/kubernetes.list]: Scheduling refresh of Class[Apt::Update]
Info: Class[Apt::Update]: Scheduling refresh of Exec[apt_update]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Ign:2 https://packages.cloud.google.com/apt bionic InRelease
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Err:4 https://packages.cloud.google.com/apt bionic Release
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: 404 Not Found [IP: 172.217.6.14 443]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Get:6 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Reading package lists...
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: E: The repository 'http://apt.kubernetes.io bionic Release' does not have a Release file.
Error: /Stage[main]/Apt::Update/Exec[apt_update]: Failed to call refresh: '/usr/bin/apt-get update' returned 100 instead of one of [0]
Error: /Stage[main]/Apt::Update/Exec[apt_update]: '/usr/bin/apt-get update' returned 100 instead of one of [0]
Info: Class[Kubernetes]: Unscheduling all events on Class[Kubernetes]
Notice: Applied catalog in 4.19 seconds
Here's the manifest's code snippet:
include apt
class kubernetes {
file { '/opt/apt-key.gpg':
source => [
"https://packages.cloud.google.com/apt/doc/apt-key.gpg"
]
}
apt::key { 'kubernetes-repository':
id => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB',
source => 'https://packages.cloud.google.com/apt/doc/apt-key.gpg',
}
apt::source { 'kubernetes':
comment => 'This is the kubernetes repository',
location => 'http://apt.kubernetes.io/',
repos => 'kubernetes-xenial main',
key => {
'id' => '54A647F9048D5688D7DA2ABE6A030B21BA07F4FB',
},
include => {
'deb' => true,
},
}
package { 'kubelet':
ensure => installed,
}
package { 'kubeadm':
ensure => installed,
}
package { 'kubectl':
ensure => installed,
}
}
node 'buildserver.mycompany.com' {
include kubernetes
}
The apt module, apt::source is creating the /etc/apt/sources.list.d/kubernetes.list file, but the entry for the repository in this file has an unwanted repository added to it. How can I prevent this error?