Install Openshift OKD 3.11 on Linux Ubuntu 18.04/Mint 19.1

Gary Gan
3 min readJan 12, 2020

--

This week let’s discuss how to install Openshift OKD (Origin) on Linux Ubuntu/Mint.

The latest Openshift OKD release is 3.11 which uses 1.11 version Kubernetes as core. I’m installing it on Linux Mint 19.1 Tessa, which is based on Ubuntu 18.04 Boinic release.

1. Install docker

#Install Dependency packages
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common

#Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

#Add the Docker repository to Linux Mint 19
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”

The docker repository Url is different for each Linux distribution and release, if install on other Linux, the Url need to changed to match distribution and release names.

#install docker-ce latest version, which is 19.03.5 for now

sudo apt update

sudo apt install docker-ce

One important step is to add current user to docker group.

sudo usermod -aG docker $USER

Logout current session and login again to make above user membership change effective.

Then we need to create docker daemon.json file to allow insecure registries.

cat << EOF | sudo tee /etc/docker/daemon.json
{
“insecure-registries” : [ “172.30.0.0/16” ]
}
EOF

#restart docker to pickup new daemon.json
sudo systemctl daemon-reload
sudo systemctl restart docker

#verify docker network config
sudo docker network inspect -f “{{range .IPAM.Config }}{{ .Subnet }}{{end}}” bridge
Expect result: 172.30.0.0/16

2. Update DNS resolv.conf file

This step need be done before Openshift installation, otherwise Openshift kube-dns won’t be able to solve any DNS name, will cause build and deployment failure.

The problem is , starting from version18.04, Ubuntu changed to use systemd-resolved to generate /etc/resolv.conf. By default it uses a local DNS cache 127.0.0.53. That will not work inside a container. Openshift kube-dns also uses host /etc/resolv.conf as base line to generate dns config, as the result the external DNS query from Openshift pod won’t be able to solve.

I got this problem when installing Openshift on Linux Mint 19 at the first time, it took me couple days to figure out where’s problem and how to fix it. Since I already installed Openshift, I had to wipe out the Openshift installation folder and docker local cache/repo to get new resolv.conf working in Openshift. That’s why we need to do this before Openshift installation.

#change the resolv.conf symlink to point to /run/systemd/resolve/resolv.conf, which lists the real DNS servers:
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

# check updated file, dns server should point to your real dns server not local cache
cat /etc/resolv.conf

3. Install Openshift OKD 3.11

#download Openshift OKD 3.11
wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz

#extract to folder
tar xvf openshift-origin-client-tools*.tar.gz

cd openshift-origin-client-tools-v3.11.0–0cbc58b-linux-64bit

#copy to bin folder
sudo mv oc kubectl /usr/local/bin/

#verify
oc version

#must add public-hostname option, otherwise Openshift can only be accessible from localhost 127.0.0.1

4. Install OpenJDK8 image stream

By default Openshift OKD only has one Java language catelog — WildFly. We need to OpenJDK8 image stream manually to build Java applications

Login as cluster admin then install new image stream to Openshift namespace:

oc login -u system:admin

oc apply -f https://raw.githubusercontent.com/minishift/minishift/master/addons/xpaas/v3.10/xpaas-streams/openjdk18-image-stream.json -n openshift

Finally let’s deploy new Java application and test.

Login to Openshift Console with developer/developer:

https://your-host-ip:8443/console

Create new project if no project exists.

Create new application from Catalog -> Red Hat OpenJDK 8.

Use below sample Spring Boot hello world git repo.

Watch the build complete then click the Routes-External Traffic link on Overview page, you should see a hello world greeting :)

Enjoy!

--

--