Spring Boot & Kubernetes
Prerequisite CLI tools
The following CLI tools are required for running the exercises in this tutorial. Please have them installed and configured before you get started with any of the tutorial chapters.
Tool | macOS | Fedora | windows |
---|---|---|---|
|
|||
|
|
||
|
|||
Minikube v1.29.0 |
|||
|
|||
|
|||
|
The following CLI tools are optional for running the exercises in this tutorial. Although they are used in the tutorial, you could use others without any problem.
Tool | macOS | Fedora | windows |
---|---|---|---|
|
|
||
watch |
|
|
|
kubectx and kubens |
|
||
|
Setup Kubernetes
The profile my-profile is created to run the tutorial:
Having minikube
installed and in your PATH
, then run:
MacOS
minikube start --memory=8192 --cpus=3 --kubernetes-version=v1.26.1 --vm-driver=virtualbox -p my-profile
Linux
minikube start --memory=8192 --cpus=3 --kubernetes-version=v1.26.1 --vm-driver=kvm2 -p my-profile
Windows:
minikube start --memory=8192 --cpus=3 --kubernetes-version=v1.26.1 --vm-driver=hyperv -p my-profile
And the output must be something similar like:
π [my-profile] minikube v1.20.0 on Darwin 11.3
β
Created a new profile : my-profile
β
minikube profile was successfully set to my-profile
π [default] minikube v1.29.0 on Darwin 11.3
β¨ Selecting 'virtualbox' driver from user configuration (alternates: [hyperkit])
π₯ Creating virtualbox VM (CPUs=2, Memory=8192MB, Disk=50000MB) ...
π³ Preparing Kubernetes v1.26.1 on Docker '20.10.6' ...
βͺ apiserver.enable-admission-plugins=LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook
π Pulling images ...
π Launching Kubernetes ...
β Waiting for cluster to come online ...
π Done! kubectl is now configured to use "my-profile"
Finally configure to use minikube internal docker as docker host:
eval $(minikube docker-env -p my-profile)
To run OpenShift4, you need to have one provisioned using try.openshift.com or can use any existing OpenShift4 cluster. Once you have your cluster, you can download the latest OpenShift client(oc) from here and add to your path.
oc version
You can check the OpenShift version using:
oc version
The output should show oc version >=4.7:
Client Version: 4.7.0-202102130115.p0-c66c03f
Kubernetes Version: v1.26.1
Then login into the OpenShift cluster using oc login
And then you are ready for start using Kubernetes:
Get tutorial sources
Before we start setting up the environment, letβs clone the tutorial sources and set the TUTORIAL_HOME
environment variable to point to the root directory of the tutorial:
git clone https://github.com/redhat-developer-demos/rhd-tutorial-common.git my_folder
export TUTORIAL_HOME="$(pwd)/my_folder"
cd $TUTORIAL_HOME