install a specific version of kubernetes on centos - docker

I installed kubernetes using these commands on centos7
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
This will install the latest version, so i'm looking for a method to install a specific version. for example 1.8.1
Thank you

To install a specific version of the package it is enough to define it during the yum install command:
yum install -y kubelet-<version> kubectl-<version> kubeadm-<version>
But for your particular case, when you want to install kubernetes version 1.8.1, kubernetes-cni package should be 0.5.1 version to satisfy dependency requirements:
--> Finished Dependency Resolution
Error: Package: kubelet-1.8.1-1.x86_64 (kubernetes)
Requires: kubernetes-cni = 0.5.1
Available: kubernetes-cni-0.3.0.1-0.07a8a2.x86_64 (kubernetes)
kubernetes-cni = 0.3.0.1-0.07a8a2
Available: kubernetes-cni-0.5.1-0.x86_64 (kubernetes)
kubernetes-cni = 0.5.1-0
Available: kubernetes-cni-0.5.1-1.x86_64 (kubernetes)
kubernetes-cni = 0.5.1-1
Installing: kubernetes-cni-0.6.0-0.x86_64 (kubernetes)
kubernetes-cni = 0.6.0-0
So, the final command is:
yum install -y kubelet-1.8.1 kubectl-1.8.1 kubeadm-1.8.1 kubernetes-cni-0.5.1

Kubernetes cluster can be ready to use in minutes, and it does not depend much on rpm/deb packages delivered by operating system vendors.
Packages are delivered for user's comfort and consistency of installation. Usually, it is possible to downgrade packages provided by CentOS without breaking dependencies, but you need to be careful.
Kubernetes includes the kubeadm tool, which can setup all dependencies and spin up cluster in version provided in the command line:
sudo kubeadm init --kubernetes-version=v1.9.2
The installation process of a specific version is described in
installation manual. I've also used scripts.
To avoid compatibility problem, please make sure your Kubernetes version is compatible with Docker containers engine version.

Related

What is the docker daemon version on Vagrant provisioner?

I am trying to understand which is the version that Vagrant installs on its VM (my specific case: using box ubuntu/trusty64) if a Docker provisioner is selected.
In particular, I would like it to be a fixed version since it has to reflect my staging environment.
Unfortunately, in the documentation of the provisioner nothing is mentioned about which version of the Docker daemon will be installed. Same by searching for my question, either on google or on github issues.
Can somebody point me to the right directions/docs?
Basically vagrant will try to install the latest version available from the repo. You can review in the source code
machine.communicate.tap do |comm|
comm.sudo("apt-get update -qq -y")
comm.sudo("apt-get install -qq -y --force-yes curl apt-transport-https")
comm.sudo("apt-get purge -qq -y lxc-docker* || true")
comm.sudo("curl -sSL https://get.docker.com/ | sh")
end
If you prefer to have a specific version installed you would need to run a shell provisioner before your docker provisioner (provisioner are run in order) and install the version you want to work with

Yum install / update not working inside docker images but working otherwise from the centos machine

I am able to yum install, or yum update from the server, but when trying to do same (as specified in the Dockerfile) inside a docker container, it fails stating the following common error :
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
my Docker file is a simple :
FROM centos:centos7
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf
RUN echo "nameserver 8.8.4.4" >> /etc/resolv.conf
RUN yum -y update; yum clean all
RUN yum -y install epel-release; yum clean all
RUN yum -y install python-pip; yum clean all
I have tried various things like adding ip_resolve=4 in /etc/yum.conf, or addinf 8.8.8.8 and 4.4.4.4 to /etc/resolv.conf and other methods, in vain.
here's the docker info :
Containers: 28
Running: 0
Paused: 0
Stopped: 28
Images: 144
Server Version: 1.13.0
docker-compose version 1.10.1, build b252738
docker-py version: 2.0.2
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
Please help. I am only running things under a VPN, no proxy.
machine is an AMI : 3.10.0-514.el7.x86_64.
Need I add it's IP anywhere insde docker container? Please help.
TIA!

Salt: 'dockerng' __virtual__ returned False

I have Debian Jessie and I'm trying to manage Docker containers with Salt dockerng. But when I try for example this state:
# file: docker_demo.sls
hello-world:
dockerng.image_present
Then sudo salt '*' state.highstate fails:
----------
ID: hello-world
Function: dockerng.image_present
Result: False
Comment: State 'dockerng.image_present' was not found in SLS 'docker_demo'
Reason: 'dockerng' __virtual__ returned False
Started:
Duration:
Changes:
How can I fix this so dockerng.image_present can pull the image, dockerng.running can run Docker containers etc.?
The dockerng module executed by Salt minion communicates with Docker daemon over REST API using docker-py (not the CLI command docker).
The error message 'dockerng' __virtual__ returned False is a little bit misleading, but if you see the source code, it returns False because it cannot import Pyhon module docker. So this Python package must be installed.
There are packages in Debian repository: python-docker and python3-docker. But both are incompatible with the recent docker-engine (installed from APT repository deb https://apt.dockerproject.org/repo debian-jessie).
So the solution is to uninstall python-docker package if installed and to install the latest docker-py using pip:
sudo apt-get install python-pip
sudo pip install docker-py
Or use this Salt state:
python-pip:
pkg.installed
docker-py:
pip.installed:
- require:
- pkg: python-pip
Or just run
salt myminion pip.install docker-py
The python-docker package from Debian Stretch (now testing, should become Debian stable in 2017) seems to be working OK.

Installing rabbitmq-server on RHEL

When trying to install rabbitmq-server on RHEL:
[ec2-user#ip-172-31-34-1XX ~]$ sudo rpm -i rabbitmq-server-3.3.5-1.noarch.rpm
error: Failed dependencies:
erlang >= R13B-03 is needed by rabbitmq-server-3.3.5-1.noarch
[ec2-user#ip-172-31-34-1XX ~]$ rpm -i rabbitmq-server-3.3.5-1.noarch.rpm
error: Failed dependencies:
erlang >= R13B-03 is needed by rabbitmq-server-3.3.5-1.noarch
I'm unsure why trying to rpm install isn't recognizing my erlang install since running $ erlgives:
[ec2-user#ip-172-31-34-1XX ~]$ which erl
/usr/local/bin/erl
[ec2-user#ip-172-31-34-1XX ~]$ sudo which erl
/bin/erl
You will need to ensure that an up-to-date version of Erlang is installed. It is available in the EPEL repository.
You can install it by performing the following:
wget -O /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo
yum install erlang
Following the above setup of Erlang, you can then proceed to install RabbitMQ as follows:
rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
yum install rabbitmq-server-3.3.5-1.noarch.rpm
You can find more info in their setup guide
You need to install erlang via RPM for it to recognise the dependency.
The erlang RPMs are available in the EPEL repository:
https://www.rabbitmq.com/install-rpm.html

How to update Jenkins/Hudson through CLI

I have a hudson installed in server's /var/lib/hudson directory. when I access jenkins through URL in my browser,, I see the version 1.411 in the bottom of the page.
Does anybody know how to update Jenkins through command line (CLI). if its possible.
When I go to Manage Jenkins page , it says something like :
"New version of Jenkins (1.521) is available for download (changelog)."
I dont feel safe with downloading the new jar and extract that in the server.
Are you referring to the Jenkins CLI, or the CLI on your operating system ? There is no way to update the Jenkins version via the Jenkins CLI.
If you installed Jenkins as a standalone WAR file, all you need to do to upgrade it from the command line is to download the new Jenkins WAR file and replace your current WAR file, then restart Jenkins. It's always a good idea to back up the full contents of your $JENKINS_HOME directory before upgrading.
If you used a native package such as an RPM or DEB, you should use the package manager on your Jenkins server (yum, apt-get etc.) to upgrade Jenkins.
Since the accepted answer doesn't tell much about upgrading Jenkins by logging into the server itself, I will add how to do that in a server that uses apt package manager.
After logging into the server, type the following command to list down all the packages that are upgradable.
apt list --upgradable
You should get an output like this:
Listing... Done
iproute2/bionic-updates 4.15.0-2ubuntu1.3 amd64 [upgradable from: 4.15.0-2ubuntu1.2]
jenkins/binary 2.277.1 all [upgradable from: 2.263.4]
If Jenkins is in the output list, just simply run the upgrade with the following command:
apt upgrade jenkins
Yes we can update the jenkins by CLI.
Check which jenkins.rpm is being used
$sudo rpm -q jenkins
in my case it was jenkins-2.119-1.1.noarch.
If you don't have jenkins.repo and jenkins key then run following steps
$sudo yum install wget
for installing wget
$sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
$sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
$sudo yum clean metadata
This will remove unused excessive and old metadata
$sudo yum remove jenkins
it will remove jenkins-2.119-1.1.noarch (old version rpm).
Go to jenkins official website page and then copy url of rpm you want
$wget https://get.jenkins.io/redhat/jenkins-2.380-1.1.noarch.rpm
Downloaded required jenkins rpm pkg
$ sudo rpm -i jenkins-2.380-1.1.noarch.rpm
Installed new jenkins rpm
$ sudo rpm -qa jenkins
jenkins-2.380-1.1.noarch
$sudo systemctl enable jenkins
$sudo systemctl start jenkins
here you may get this type of error
"Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe"for details"
for this we have to update the java version we are using to 11 or latest
$sudo yum install fontconfig java-11-openjdk
or
$sudo yum install java-11-openjdk-devel
$sudo update-alternatives --config java
select appropriate version of java
$sudo systemctl start jenkins

Resources