I am trying to use puppet to configure a ubuntu 18.04 server as a kubernetes master. I have written a manifest to install kubectl,kubeadm and kubelet add the Kubernetes repository via Puppet's apt module.
When i run the command sudo puppet agent -t to apply the manifest, i am getting the following error:
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
my manifest file is shown below:
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
}
apt::source is creating the expected /etc/apt/sources.list.d/kubernetes.list file, but the entry for the repository in this file has an unwanted 'bionic' repository added to it. The entry in the file looks like this:
deb http://apt.kubernetes.io/ bionic kubernetes-xenial main
instead of
deb http://apt.kubernetes.io/ kubernetes-xenial main
How can i prevent this? kindly help!