Monday, November 30, 2020

Configure Jenkins agent using declarative pipeline

HOWTO

Sample projects

 

Configure Jenkins agent

agent

    The agent section specifies where the entire Pipeline, or a specific stage, will execute in the Jenkins environment depending on where the agent section is placed. The section must be defined at the top-level inside the pipeline block, but stage-level usage is optional.

 

label 
  
   Execute the Pipeline, or stage, on an agent available in the Jenkins environment with the provided label. For example: agent { label 'my-defined-label' }

 

node

agent { node { label 'labelName' } } behaves the same as agent { label 'labelName' }, but node allows for additional options (such as customWorkspace).

 

Multiple agents

pipeline {
    agent none
    stages {
        stage('Build') {
            agent any
            steps {
                checkout scm
                sh 'make'
                stash includes: '**/target/*.jar', name: 'app' 
            }
        }
        stage('Test on Linux') {
            agent { 
                label 'linux'
            }
            steps {
                unstash 'app' 
                sh 'make check'
            }
            post {
                always {
                    junit '**/target/*.xml'
                }
            }
        }
        stage('Test on Windows') {
            agent {
                label 'windows'
            }
            steps {
                unstash 'app'
                bat 'make check' 
            }
            post {
                always {
                    junit '**/target/*.xml'
                }
            }
        }
    }
} 
Configure GitHub credentials for Jenkins

Configure pipeline 

GitHub credentials must be username/password ( use GH token) 

https://stackoverflow.com/questions/38461705/checkout-jenkins-pipeline-git-scm-with-credentials?rq=1

If you're using the ssh url then your credentials must be username + private key. If you're using the https clone url instead of the ssh one, then your credentials should be username + password.

 To change working dir use dir ('somedir'){ ... }

https://github.com/dveselka/weblogic/blob/master/Jenkinsfile  

node {

        stage('Checkout') {
          git url: 'https://github.com/dveselka/weblogic/', credentialsId: 'dave-devops', branch: 'weblogic-14.1.1'
        }

        stage('Build') {
            dir ('dave-basic-webapp-ejb-project') {
                withMaven(maven:'local') {
                   sh 'mvn clean package'

                   def pom = readMavenPom file:'pom.xml'
                   print pom.version
                   env.version = pom.version
                }
            }     
        }

}

Install Maven pipeline plugin

https://www.jenkins.io/doc/pipeline/steps/pipeline-maven/

https://plugins.jenkins.io/pipeline-maven/

Install  Pipeline utility steps plugin

https://plugins.jenkins.io/pipeline-utility-steps/

 

Configure Maven 

dave@dave ~]$ which mvn
/opt/maven/bin/mvn
[dave@dave ~]$ mvn --version
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: /opt/maven
Java version: 11.0.9, vendor: Oracle Corporation, runtime: /usr/java/jdk-11.0.9
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.9.15-100.fc32.x86_64", arch: "amd64", family: "unix"

https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlprg/maven.html#GUID-C6FC7582-2D1C-4EA5-B000-71AE9A2F2B05


 Configure Oracle Maven repository for Weblogic


[dave@dave 14.1.1]$ cd /app/weblogic/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/14.1.1/^C
[dave@dave 14.1.1]$ mvn install:install-file -DpomFile=oracle-maven-sync-14.1.1.pom -Dfile=oracle-maven-sync-14.1.1.jar
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /app/weblogic/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/14.1.1/oracle-maven-sync-14.1.1.jar to /home/dave/.m2/repository/com/oracle/maven/oracle-maven-sync/14.1.1-0-0/oracle-maven-sync-14.1.1-0-0.jar
[INFO] Installing /app/weblogic/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/14.1.1/oracle-maven-sync-14.1.1.pom to /home/dave/.m2/repository/com/oracle/maven/oracle-maven-sync/14.1.1-0-0/oracle-maven-sync-14.1.1-0-0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

Install Oracle artifacts into local repo
[dave@dave 14.1.1]$ mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=/app/weblogic

 

Build pipeline 

 

Started by user DaVe
Obtained Jenkinsfile from git https://github.com/dveselka/weblogic/
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/weblogic-pipeline
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout)
[Pipeline] git
The recommended git tool is: NONE
using credential dave-devops
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/dveselka/weblogic/ # timeout=10
Fetching upstream changes from https://github.com/dveselka/weblogic/
 > git --version # timeout=10
 > git --version # 'git version 2.26.2'
using GIT_ASKPASS to set credentials dave-devops
 > git fetch --tags --force --progress -- https://github.com/dveselka/weblogic/ +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/weblogic-14.1.1^{commit} # timeout=10
Checking out Revision d880e4d74b8302545401074d68fd449115fdca1b (refs/remotes/origin/weblogic-14.1.1)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f d880e4d74b8302545401074d68fd449115fdca1b # timeout=10
 > git branch -a -v --no-abbrev # timeout=10
 > git branch -D weblogic-14.1.1 # timeout=10
 > git checkout -b weblogic-14.1.1 d880e4d74b8302545401074d68fd449115fdca1b # timeout=10
Commit message: "Merge pull request #2 from dveselka/master"
 > git rev-list --no-walk 7fe92410b7aab93803b8dbd39200a48c23331709 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] dir
Running in /var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project
[Pipeline] {
[Pipeline] withMaven
[withMaven] Options: []
[withMaven] Available options: 
[withMaven] using JDK installation provided by the build agent
[withMaven] using Maven installation 'local'
[Pipeline] {
[Pipeline] sh
+ mvn clean package
----- withMaven Wrapper script -----
Picked up JAVA_TOOL_OPTIONS: -Dmaven.ext.class.path="/var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project@tmp/withMaven8d13bb8c/pipeline-maven-spy.jar" -Dorg.jenkinsci.plugins.pipeline.maven.reportsFolder="/var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project@tmp/withMaven8d13bb8c" 
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: /opt/maven
Java version: 11.0.9, vendor: Oracle Corporation, runtime: /usr/java/jdk-11.0.9
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.9.15-100.fc32.x86_64", arch: "amd64", family: "unix"
[INFO] [jenkins-event-spy] Generate /var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project@tmp/withMaven8d13bb8c/maven-spy-20201227-095826-57316330863830296583212.log.tmp ...
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< dave:dave-basic-webapp-ejb-project >-----------------
[INFO] Building basicWebappEjb 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ dave-basic-webapp-ejb-project ---
[INFO] Deleting /var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ dave-basic-webapp-ejb-project ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ dave-basic-webapp-ejb-project ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 6 source files to /var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ dave-basic-webapp-ejb-project ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ dave-basic-webapp-ejb-project ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ dave-basic-webapp-ejb-project ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ dave-basic-webapp-ejb-project ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/var/lib/jenkins/.m2/repository/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar) to field java.util.Properties.defaults
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Packaging webapp
[INFO] Assembling webapp [dave-basic-webapp-ejb-project] in [/var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project/target/basicWebappEjb]
[INFO] Processing war project
[INFO] Copying webapp resources [/var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project/src/main/webapp]

[INFO] Webapp assembled in [33 msecs]
[INFO] Building war: /var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project/target/basicWebappEjb.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.763 s
[INFO] Finished at: 2020-12-27T09:58:29+01:00
[INFO] ------------------------------------------------------------------------
[INFO] [jenkins-event-spy] Generated /var/lib/jenkins/workspace/weblogic-pipeline/dave-basic-webapp-ejb-project@tmp/withMaven8d13bb8c/maven-spy-20201227-095826-57316330863830296583212.log
[Pipeline] readMavenPom
[Pipeline] echo
1.0-SNAPSHOT
[Pipeline] }
[withMaven] artifactsPublisher - Archive artifact pom.xml under dave/dave-basic-webapp-ejb-project/1.0-SNAPSHOT/dave-basic-webapp-ejb-project-1.0-SNAPSHOT.pom
[withMaven] artifactsPublisher - Archive artifact target/basicWebappEjb.war under dave/dave-basic-webapp-ejb-project/1.0-SNAPSHOT/dave-basic-webapp-ejb-project-1.0-SNAPSHOT.war
[withMaven] junitPublisher - Archive test results for Maven artifact dave:dave-basic-webapp-ejb-project:war:1.0-SNAPSHOT generated by maven-surefire-plugin:test (default-test): target/surefire-reports/*.xml
[withMaven] junitPublisher - Jenkins JUnit Attachments Plugin not found, can't publish test attachments.Recording test results
None of the test reports contained any result
[withMaven] Jenkins Task Scanner Plugin not found, don't display results of source code scanning for 'TODO' and 'FIXME' in pipeline screen.
[withMaven] Publishers: Pipeline Graph Publisher: 3 ms, Generated Artifacts Publisher: 17 ms, Junit Publisher: 31 ms
[Pipeline] // withMaven
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

 

Saturday, November 28, 2020

Install Jenkins via Ansible

HOWTO 


  • Install Jenkins using Galaxy role  https://training.galaxyproject.org/training-material/topics/admin/tutorials/jenkins/tutorial.html



Clone repository with playbook

https://github.com/dveselka/devops-ansible/tree/master/jenkins

[dave@dave ~]$ git clone https://github.com/dveselka/devops-ansible

Install Ansible Galaxy roles
[dave@dave ~]$ cd devops-ansible/
[dave@dave devops-ansible]$ cd jenkins/
[dave@dave jenkins]$ ls
create_jenkins.yml  dev_vars.yml  README.md  requirements.yml
[dave@dave jenkins]$ ansible-galaxy install -p roles -r requirements.yml
- downloading role 'java', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-java/archive/1.10.0.tar.gz
- extracting geerlingguy.java to /home/dave/devops-ansible/jenkins/roles/geerlingguy.java
- geerlingguy.java (1.10.0) was installed successfully
- downloading role 'jenkins', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-jenkins/archive/4.3.0.tar.gz
- extracting geerlingguy.jenkins to /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins
- geerlingguy.jenkins (4.3.0) was installed successfully


Check Java version
[dave@dave jenkins]$ java -version
java version "11.0.9" 2020-10-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.9+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.9+7-LTS, mixed mode)



Run Ansible playbook
[dave@dave jenkins]$ ansible-playbook -K  create_jenkins.yml 
BECOME password: 
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Install Jenkins on localhost] *****************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : Include OS-specific variables for Fedora or FreeBSD.] **********************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : Include version-specific variables for CentOS/RHEL.] ***********************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Include version-specific variables for Ubuntu.] ****************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Include version-specific variables for Debian.] ****************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Define java_packages.] *****************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : include_tasks] *************************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.java/tasks/setup-RedHat.yml for localhost

TASK [geerlingguy.java : Ensure Java is installed.] *************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.java : include_tasks] *************************************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : include_tasks] *************************************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.java : Set JAVA_HOME if configured.] **********************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Include OS-Specific variables] ******************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Define jenkins_repo_url] ************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Define jenkins_repo_key_url] ********************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Define jenkins_pkg_url] *************************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins/tasks/setup-RedHat.yml for localhost

TASK [geerlingguy.jenkins : Ensure dependencies are installed.] *************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Ensure Jenkins repo is installed.] **************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Add Jenkins repo GPG key.] **********************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Download specific Jenkins version.] *************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Check if we downloaded a specific version of Jenkins.] ******************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Install our specific version of Jenkins.] *******************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Ensure Jenkins is installed.] *******************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins/tasks/settings.yml for localhost

TASK [geerlingguy.jenkins : Check if jenkins_init_file exists.] *************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Ensure jenkins_init_file exists.] ***************************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Modify variables in init file.] *****************************************************************************************************************************************************
changed: [localhost] => (item={'option': 'JENKINS_ARGS', 'value': '--prefix='})
changed: [localhost] => (item={'option': 'JENKINS_JAVA_OPTIONS', 'value': '-Xmx4096M'})

TASK [geerlingguy.jenkins : Ensure jenkins_home /var/lib/jenkins exists.] ***************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Set the Jenkins home directory.] ****************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Immediately restart Jenkins on init config changes.] ********************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Set HTTP port in Jenkins config.] ***************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Create custom init scripts directory.] **********************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Configure proxy config for Jenkins] *************************************************************************************************************************************************
skipping: [localhost]

RUNNING HANDLER [geerlingguy.jenkins : configure default users] *************************************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Immediately restart Jenkins on http or user changes.] *******************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Ensure Jenkins is started and runs on startup.] *************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Wait for Jenkins to start up before proceeding.] ************************************************************************************************************************************
FAILED - RETRYING: Wait for Jenkins to start up before proceeding. (60 retries left).
FAILED - RETRYING: Wait for Jenkins to start up before proceeding. (59 retries left).
FAILED - RETRYING: Wait for Jenkins to start up before proceeding. (58 retries left).
ok: [localhost]

TASK [geerlingguy.jenkins : Get the jenkins-cli jarfile from the Jenkins server.] *******************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : Remove Jenkins security init scripts after first startup.] **************************************************************************************************************************
changed: [localhost]

TASK [geerlingguy.jenkins : include_tasks] **********************************************************************************************************************************************************************
included: /home/dave/devops-ansible/jenkins/roles/geerlingguy.jenkins/tasks/plugins.yml for localhost

TASK [geerlingguy.jenkins : Get Jenkins admin password from file.] **********************************************************************************************************************************************
skipping: [localhost]

TASK [geerlingguy.jenkins : Set Jenkins admin password fact.] ***************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Create Jenkins updates directory.] **************************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Download current plugin updates from Jenkins update site.] **************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Remove first and last line from json file.] *****************************************************************************************************************************************
ok: [localhost]

TASK [geerlingguy.jenkins : Install Jenkins plugins using password.] ********************************************************************************************************************************************

PLAY RECAP ******************************************************************************************************************************************************************************************************
localhost                  : ok=34   changed=13   unreachable=0    failed=0    skipped=13   rescued=0    ignored=0   


Configure nodes 

https://www.howtoforge.com/tutorial/ubuntu-jenkins-master-slave/



Tuesday, November 10, 2020

Google Cloud code IDE extension

 https://cloud.google.com/code/docs/vscode

 

Install VS Code https://code.visualstudio.com/docs/setup/linux#_installation

rpm --import https://packages.microsoft.com/keys/microsoft.asc
sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
dnf check-update
dnf install code

Install Google Code extension into VS Code

Open k8s project 

 https://github.com/dveselka/devops-k8s/tree/main/complex

Terraform project 


 

Azure Terraform - add extension 

 https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureterraform

 



Bridge to minikube 

https://code.visualstudio.com/docs/containers/bridge-to-kubernetes

 



Weblogic - Docker compose 

https://github.com/oracle/docker-images/tree/master/OracleWebLogic

 


 

Deploy application on Google Cloud k8s using Travis

 HOWTO

See other blogs entries

 

GitHub repos

 

Deployed application - Google Cloud console

 





Travis CI





 

 

 

Install Ingress using Helm on Google cloud

 HOWTO

 https://helm.sh/docs/intro/install/#from-script

 https://helm.sh/docs/intro/using_helm/

 https://github.com/kubernetes/ingress-nginx

https://kubernetes.github.io/ingress-nginx/deploy/#using-helm


Install Helm

daniel_veselka@cloudshell:~ (genial-acronym-295114)$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
daniel_veselka@cloudshell:~ (genial-acronym-295114)$ chmod 700 get_helm.sh
daniel_veselka@cloudshell:~ (genial-acronym-295114)$ ./get_helm.sh
Helm v3.4.0 is available. Changing from version v3.2.1.
Downloading https://get.helm.sh/helm-v3.4.0-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm
daniel_veselka@cloudshell:~ (genial-acronym-295114)$ helm version
version.BuildInfo{Version:"v3.4.0", GitCommit:"7090a89efc8a18f3d8178bf47d2462450349a004", GitTreeState:"clean", GoVersion:"go1.14.10"}

Install Ingress

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm install my-release ingress-nginx/ingress-nginx

daniel_veselka@cloudshell:~ (genial-acronym-295114)$ POD_NAME=$(kubectl get pods -l app.kubernetes.io/name=ingress-nginx -o jsonpath='{.items[0].metadata.name}')
daniel_veselka@cloudshell:~ (genial-acronym-295114)$ kubectl exec -it $POD_NAME -- /nginx-ingress-controller --version
-------------------------------------------------------------------------------
NGINX Ingress controller
  Release:       v0.41.0
  Build:         f3a6b809bd4bb6608266b35cf5b8423bf107d7bc
  Repository:    https://github.com/kubernetes/ingress-nginx
  nginx version: nginx/1.19.4

-------------------------------------------------------------------------------

Configure user access - service accounts and roles

k8s namespaces on GCP

daniel_veselka@cloudshell:~ (genial-acronym-295114)$ kubectl get namespaces
NAME              STATUS   AGE
default           Active   15h
kube-node-lease   Active   15h
kube-public       Active   15h
kube-system       Active   15h

Configure roles - not required with Helm3 - tiller removed

daniel_veselka@cloudshell:~ (genial-acronym-295114)$ kubectl create serviceaccount --namespace kube-system tiller
serviceaccount/tiller created
daniel_veselka@cloudshell:~ (genial-acronym-295114)$ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-systen:tiller
clusterrolebinding.rbac.authorization.k8s.io/tiller-cluster-rule created


HTTPS configuration

  • https://github.com/StephenGrider/multi-k8s/blob/master/k8s/certificate.yaml
  • https://github.com/StephenGrider/multi-k8s/blob/master/k8s/issuer.yaml

Monday, November 9, 2020

Install Docker application into Google Cloud k8s

 HOWTO

https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide/

GitHub repo

https://github.com/StephenGrider/multi-k8s/blob/master/.travis.yml

https://github.com/dveselka/devops-k8s/blob/main/.travis.yml

 

Install Google Cloud SDK CLI

[dave@dave git]$ sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
> [google-cloud-sdk]
> name=Google Cloud SDK
> baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
> 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
> EOM
[sudo] password for dave: 
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
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
[dave@dave git]$ sudo dnf install google-cloud-sdk
Google Cloud SDK                                                                                                                                                   364  B/s | 454  B     00:01    
Google Cloud SDK                                                                                                                                                    15 kB/s | 1.8 kB     00:00    
Importing GPG key 0xA7317B0F:
 Userid     : "Google Cloud Packages Automatic Signing Key <gc-team@google.com>"
 Fingerprint: D0BC 747F D8CA F711 7500 D6FA 3746 C208 A731 7B0F
 From       : https://packages.cloud.google.com/yum/doc/yum-key.gpg
Is this ok [y/N]: y
Importing GPG key 0xBA07F4FB:
 Userid     : "Google Cloud Packages Automatic Signing Key <gc-team@google.com>"
 Fingerprint: 54A6 47F9 048D 5688 D7DA 2ABE 6A03 0B21 BA07 F4FB
 From       : https://packages.cloud.google.com/yum/doc/yum-key.gpg
Is this ok [y/N]: y
Google Cloud SDK                                                                                                                                                   6.7 kB/s | 975  B     00:00    
Importing GPG key 0x3E1BA8D5:
 Userid     : "Google Cloud Packages RPM Signing Key <gc-team@google.com>"
 Fingerprint: 3749 E1BA 95A8 6CE0 5454 6ED2 F09C 394C 3E1B A8D5
 From       : https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
Is this ok [y/N]: y
Google Cloud SDK                                                                                                                                                   7.0 MB/s |  22 MB     00:03    
Last metadata expiration check: 0:00:06 ago on Mon 09 Nov 2020 07:32:03 PM CET.
Dependencies resolved.
===================================================================================================================================================================================================
 Package                                            Architecture                             Version                                      Repository                                          Size
===================================================================================================================================================================================================
Installing:
 google-cloud-sdk                                   x86_64                                   317.0.0-1                                    google-cloud-sdk                                    72 M

Transaction Summary
===================================================================================================================================================================================================
Install  1 Package

Total download size: 72 M
Installed size: 359 M
Is this ok [y/N]: 


 

Init Google Cloud CLI

[dave@dave git]$ gcloud init
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.                                                                                                                                                               
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

You must log in to continue. Would you like to log in (Y/n)?


Install Travis CLI

     $ sudo dnf install ruby 

     $ ruby --version
    ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

    git clone https://github.com/travis-ci/travis.rb
    Cloning into 'travis.rb'...

Install travis

$ gem install travis  
Fetching multipart-post-2.1.1.gem
Fetching ruby2_keywords-0.0.2.gem
Fetching faraday-1.1.0.gem
Fetching faraday_middleware-1.0.0.gem
Fetching highline-2.0.3.gem
Fetching concurrent-ruby-1.1.7.gem
Fetching i18n-1.8.5.gem
Fetching thread_safe-0.3.6.gem
Fetching tzinfo-1.2.8.gem
Fetching minitest-5.14.2.gem
Fetching activesupport-5.2.4.4.gem
Fetching multi_json-1.15.0.gem
Fetching public_suffix-4.0.6.gem
Fetching addressable-2.7.0.gem
Fetching net-http-persistent-2.9.4.gem
Fetching net-http-pipeline-1.0.1.gem
Fetching travis-1.10.0.gem
Fetching gh-0.18.0.gem
Fetching launchy-2.4.3.gem
Fetching json_pure-2.3.1.gem
Fetching websocket-1.2.8.gem
Fetching pusher-client-0.6.2.gem
Successfully installed multipart-post-2.1.1
Successfully installed ruby2_keywords-0.0.2
Successfully installed faraday-1.1.0
Successfully installed faraday_middleware-1.0.0
Successfully installed highline-2.0.3
Successfully installed concurrent-ruby-1.1.7

HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.

If you are upgrading your Rails application from an older version of Rails:

Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.

If you are starting a NEW Rails application, you can ignore this notice.

For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0

Successfully installed i18n-1.8.5
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.8
Successfully installed minitest-5.14.2
Successfully installed activesupport-5.2.4.4
Successfully installed multi_json-1.15.0
Successfully installed public_suffix-4.0.6
Successfully installed addressable-2.7.0
Successfully installed net-http-persistent-2.9.4
Successfully installed net-http-pipeline-1.0.1
Successfully installed gh-0.18.0
Successfully installed launchy-2.4.3
Successfully installed json_pure-2.3.1
Successfully installed websocket-1.2.8
Successfully installed pusher-client-0.6.2
Successfully installed travis-1.10.0
Parsing documentation for multipart-post-2.1.1
Installing ri documentation for multipart-post-2.1.1
Parsing documentation for ruby2_keywords-0.0.2
Installing ri documentation for ruby2_keywords-0.0.2
Parsing documentation for faraday-1.1.0
Installing ri documentation for faraday-1.1.0
Parsing documentation for faraday_middleware-1.0.0
Installing ri documentation for faraday_middleware-1.0.0
Parsing documentation for highline-2.0.3
Installing ri documentation for highline-2.0.3
Parsing documentation for concurrent-ruby-1.1.7
Installing ri documentation for concurrent-ruby-1.1.7
Parsing documentation for i18n-1.8.5
Installing ri documentation for i18n-1.8.5
Parsing documentation for thread_safe-0.3.6
Installing ri documentation for thread_safe-0.3.6
Parsing documentation for tzinfo-1.2.8
Installing ri documentation for tzinfo-1.2.8
Parsing documentation for minitest-5.14.2
Installing ri documentation for minitest-5.14.2
Parsing documentation for activesupport-5.2.4.4
Installing ri documentation for activesupport-5.2.4.4
Parsing documentation for multi_json-1.15.0
Installing ri documentation for multi_json-1.15.0
Parsing documentation for public_suffix-4.0.6
Installing ri documentation for public_suffix-4.0.6
Parsing documentation for addressable-2.7.0
Installing ri documentation for addressable-2.7.0
Parsing documentation for net-http-persistent-2.9.4
Installing ri documentation for net-http-persistent-2.9.4
Parsing documentation for net-http-pipeline-1.0.1
Installing ri documentation for net-http-pipeline-1.0.1
Parsing documentation for gh-0.18.0
Installing ri documentation for gh-0.18.0
Parsing documentation for launchy-2.4.3
Installing ri documentation for launchy-2.4.3
Parsing documentation for json_pure-2.3.1
Installing ri documentation for json_pure-2.3.1
Parsing documentation for websocket-1.2.8
Installing ri documentation for websocket-1.2.8
Parsing documentation for pusher-client-0.6.2
Installing ri documentation for pusher-client-0.6.2
Parsing documentation for travis-1.10.0
Installing ri documentation for travis-1.10.0
Done installing documentation for multipart-post, ruby2_keywords, faraday, faraday_middleware, highline, concurrent-ruby, i18n, thread_safe, tzinfo, minitest, activesupport, multi_json, public_suffix, addressable, net-http-persistent, net-http-pipeline, gh, launchy, json_pure, websocket, pusher-client, travis after 15 seconds
22 gems installed

 
Login to travis

[dave@dave bin]$ travis login
Shell completion not installed. Would you like to install it now? |y| y
We need your GitHub login to identify you.
This information will not be sent to Travis CI, only to api.github.com.
The password will not be displayed.

Try running with --github-token or --auto if you don't want to enter your password anyway.

Username: dveselka 
Password for dveselka: ********
Successfully logged in as dveselka!

Encrypt service account for Travis
[dave@dave complex]$ travis encrypt-file service-account.json -r dveselka/devops-k8s
encrypting service-account.json for dveselka/devops-k8s
storing result as service-account.json.enc
storing secure env variables for decryption

Please add the following to your build script (before_install stage in your .travis.yml, for instance):

    openssl aes-256-cbc -K $encrypted_9f3b5599b056_key -iv $encrypted_9f3b5599b056_iv -in service-account.json.enc -out service-account.json -d

Pro Tip: You can add it automatically by running with --add.

Make sure to add service-account.json.enc to the git repository.
Make sure not to add service-account.json to the git repository.
Commit all changes to your .travis.yml.

Configure GCP project names and zone

 https://cloud.google.com/compute/docs/regions-zones 

 

Create account on https://hub.docker.com/

 

 Check Travis builds  

https://travis-ci.org/github/dveselka/devops-k8s/builds

 Add k8s secret using GCP shell

 

  Set Postgress password

daniel_veselka@cloudshell:~ (genial-acronym-295114)$  kubectl create secret generic pgpassword --from-literal POSTGRESS_PASSWORD=password123
secret/pgpassword created

K8s Ingress on minikube


HOWTO

https://www.udemy.com/course/docker-and-kubernetes-the-complete-guide/

https://kubernetes.io/docs/concepts/services-networking/ingress/

https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

https://github.com/kubernetes/ingress-nginx

https://www.joyfulbikeshedding.com/blog/2018-03-26-studying-the-kubernetes-ingress-system.html

https://minikube.sigs.k8s.io/docs/drivers/docker/#known-issues

 

GitHub repos

https://github.com/dveselka/devops-k8s/tree/main/complex

https://github.com/StephenGrider/multi-k8s

 

Start a cluster using the docker driver:

minikube start --driver=docker

To make docker the default driver:

minikube config set driver docker
 
[dave@dave complex]$ minikube config set driver docker
❗  These changes will take effect upon a minikube delete and then a minikube start
[dave@dave complex]$ minikube delete
🔥  Deleting "minikube" in docker ...
🔥  Deleting container "minikube" ...
🔥  Removing /home/dave/.minikube/machines/minikube ...
💀  Removed all traces of the "minikube" cluster.
[dave@dave complex]$ minikube start
😄  minikube v1.14.2 on Fedora 32
✨  Using the docker driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🔥  Creating docker container (CPUs=2, Memory=3900MB) ...
 🐳  Preparing Kubernetes v1.19.2 on Docker 19.03.8 ...
🔎 Verifying Kubernetes components...
🌟 Enabled addons: storage-provisioner, default-storageclass

❗ /usr/bin/kubectl is version 1.15.8-beta.0, which may have incompatibilites with Kubernetes 1.19.2.
💡 Want kubectl v1.19.2? Try 'minikube kubectl -- get pods -A'
🏄 Done! kubectl is now configured to use "minikube" by default
 

Check type of container

[dave@dave complex]$ docker info --format '{{.OSType}}'
linux


Provider specific steps

https://kubernetes.github.io/ingress-nginx/deploy/#provider-specific-steps

Google Cloud https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.0/deploy/static/provider/cloud/deploy.yaml


Minikube

[dave@dave complex]$ minikube addons enable ingress
🔎  Verifying ingress addon...
🌟  The 'ingress' addon is enabled

 

Apply config files

kubectl apply -f k8s/
service/client-cluster-ip-service created
deployment.apps/client-deployment created
persistentvolumeclaim/database-persistent-volume-claim created
ingress.networking.k8s.io/ingress-service created
service/postgres-cluster-ip-service created
deployment.apps/postgres-deployment created
service/redis-cluster-ip-service created
deployment.apps/redis-deployment created
service/server-cluster-ip-service created
deployment.apps/server-deployment created
deployment.apps/worker-deployment created

 Check HTTP connection

[dave@dave complex]$ minikube ip
192.168.49.2
[dave@dave complex]$ wget 192.168.49.2
--2020-11-09 14:13:35--  http://192.168.49.2/
Connecting to 192.168.49.2:80... connected.
HTTP request sent, awaiting response... 200 OK

 Add POSTGRESS password via k8s secret

[dave@dave complex]$ kubectl create secret generic pgpassword --from-literal PGPASSWORD=password123
secret/pgpassword created

 Check app in k8s dashboard

[dave@dave complex]$ minikube dashboard
🔌  Enabling dashboard ...
🤔  Verifying dashboard health ...
🚀  Launching proxy ...
🤔  Verifying proxy health ...
🎉  Opening http://127.0.0.1:42189/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...  

k8s dashboard 


Tuesday, November 3, 2020

Install kubectl and minikube on Fedora 32

 Install kubectl

In your terminal run the following:

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

[dave@dave tmp]$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 41.0M  100 41.0M    0     0  13.7M      0  0:00:02  0:00:02 --:--:-- 13.7M
[dave@dave tmp]$ ls -l ./kubectl 
-rw-rw-r--. 1 dave dave 43003904 Nov  3 22:15 ./kubectl

chmod +x ./kubectl

sudo mv ./kubectl /usr/local/bin/kubectl


Check your Installation:

kubectl version

[dave@dave tmp]$ sudo mv ./kubectl /usr/local/kubectl
[dave@dave tmp]$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.8-beta.0", GitCommit:"6c143d35bb11d74970e7bc0b6c45b6bfdffc0bd4", GitTreeState:"archive", BuildDate:"2020-01-29T00:00:00Z", GoVersion:"go1.14beta1", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

See also official docs:
https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-linux

 

Install minikube

https://minikube.sigs.k8s.io/docs/start/

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
sudo rpm -ivh minikube-latest.x86_64.rpm

First start

 

[dave@dave simple-k8s]$ minikube delete
🔥  Deleting "minikube" in kvm2 ...
💀  Removed all traces of the "minikube" cluster.
[dave@dave simple-k8s]$ minikube start
😄  minikube v1.14.2 on Fedora 32
✨  Using the kvm2 driver based on user configuration
💿  Downloading VM boot image ...
    > minikube-v1.14.0.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s
    > minikube-v1.14.0.iso: 178.27 MiB / 178.27 MiB [ 100.00% 16.39 MiB p/s 11s
👍  Starting control plane node minikube in cluster minikube
💾  Downloading Kubernetes v1.19.2 preload ...
    > preloaded-images-k8s-v6-v1.19.2-docker-overlay2-amd64.tar.lz4: 486.33 MiB
🔥  Creating kvm2 VM (CPUs=2, Memory=3900MB, Disk=20000MB) ...
🔥  Deleting "minikube" in kvm2 ...
🤦  StartHost failed, but will try again: creating host: create: Error creating machine: Error in driver during machine creation: ensuring active networks: starting network default: virError(Code=89, Domain=47, Message='error from service: changeZoneOfInterface: COMMAND_FAILED: 'python-nftables' failed: 
JSON blob:
{"nftables": [{"metainfo": {"json_schema_version": 1}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "udp", "field": "dport"}}, "op": "==", "right": 67}}, {"match": {"left": {"ct": {"key": "state"}}, "op": "in", "right": {"set": ["new", "untracked"]}}}, {"accept": null}]}}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "udp", "field": "dport"}}, "op": "==", "right": 547}}, {"match": {"left": {"ct": {"key": "state"}}, "op": "in", "right": {"set": ["new", "untracked"]}}}, {"accept": null}]}}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "tcp", "field": "dport"}}, "op": "==", "right": 53}}, {"match": {"left": {"ct": {"key": "state"}}')
🔥  Creating kvm2 VM (CPUs=2, Memory=3900MB, Disk=20000MB) ...
😿  Failed to start kvm2 VM. Running "minikube delete" may fix it: creating host: create: Error creating machine: Error in driver during machine creation: ensuring active networks: starting network default: virError(Code=89, Domain=47, Message='error from service: changeZoneOfInterface: COMMAND_FAILED: 'python-nftables' failed: 
JSON blob:
{"nftables": [{"metainfo": {"json_schema_version": 1}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "udp", "field": "dport"}}, "op": "==", "right": 67}}, {"match": {"left": {"ct": {"key": "state"}}, "op": "in", "right": {"set": ["new", "untracked"]}}}, {"accept": null}]}}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "udp", "field": "dport"}}, "op": "==", "right": 547}}, {"match": {"left": {"ct": {"key": "state"}}, "op": "in", "right": {"set": ["new", "untracked"]}}}, {"accept": null}]}}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "tcp", "field": "dport"}}, "op": "==", "right": 53}}, {"match": {"left": {"ct": {"key": "state"}}')

❌  Exiting due to GUEST_PROVISION: Failed to start host: creating host: create: Error creating machine: Error in driver during machine creation: ensuring active networks: starting network default: virError(Code=89, Domain=47, Message='error from service: changeZoneOfInterface: COMMAND_FAILED: 'python-nftables' failed: 
JSON blob:
{"nftables": [{"metainfo": {"json_schema_version": 1}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "udp", "field": "dport"}}, "op": "==", "right": 67}}, {"match": {"left": {"ct": {"key": "state"}}, "op": "in", "right": {"set": ["new", "untracked"]}}}, {"accept": null}]}}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "udp", "field": "dport"}}, "op": "==", "right": 547}}, {"match": {"left": {"ct": {"key": "state"}}, "op": "in", "right": {"set": ["new", "untracked"]}}}, {"accept": null}]}}}, {"add": {"rule": {"family": "inet", "table": "firewalld", "chain": "filter_IN_libvirt_allow", "expr": [{"match": {"left": {"payload": {"protocol": "tcp", "field": "dport"}}, "op": "==", "right": 53}}, {"match": {"left": {"ct": {"key": "state"}}')

😿  If the above advice does not help, please let us know: 
👉  https://github.com/kubernetes/minikube/issues/new/choose

 Trying with driver=docker

[dave@dave simple-k8s]$ minikube start --driver=docker
😄  minikube v1.14.2 on Fedora 32
❗  Both driver=docker and vm-driver=kvm2 have been set.

    Since vm-driver is deprecated, minikube will default to driver=docker.

    If vm-driver is set in the global config, please run "minikube config unset vm-driver" to resolve this warning.
            
✨  Using the docker driver based on user configuration
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🔥  Creating docker container (CPUs=2, Memory=3900MB) ...

🧯  Docker is nearly out of disk space, which may cause deployments to fail! (94% of capacity)
💡  Suggestion: 

    Try at least one of the following to free up space on the device:
    
    1. Run "docker system prune" to remove unused docker data
    2. Increase the amount of memory allocated to Docker for Desktop via
    Docker icon > Preferences > Resources > Disk Image Size
    3. Run "minikube ssh -- docker system prune" if using the docker container runtime
🍿  Related issue: https://github.com/kubernetes/minikube/issues/9024

🐳  Preparing Kubernetes v1.19.2 on Docker 19.03.8 ...
🔎  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass

❗  /usr/bin/kubectl is version 1.15.8-beta.0, which may have incompatibilites with Kubernetes 1.19.2.
💡  Want kubectl v1.19.2? Try 'minikube kubectl -- get pods -A'
🏄  Done! kubectl is now configured to use "minikube" by default

 List pods on k8s cluster

[dave@dave simple-k8s]$ kubectl get po -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
default       client-pod                         1/1     Running   0          62s
kube-system   coredns-f9fd979d6-t8ktc            1/1     Running   0          2m28s
kube-system   etcd-minikube                      1/1     Running   0          2m26s
kube-system   kube-apiserver-minikube            1/1     Running   0          2m27s
kube-system   kube-controller-manager-minikube   1/1     Running   0          2m27s
kube-system   kube-proxy-tg8zg                   1/1     Running   0          2m28s
kube-system   kube-scheduler-minikube            1/1     Running   0          2m27s
kube-system   storage-provisioner                1/1     Running   1          2m31s

Configure docker client in terminal

   eval $(minikube docker-env)
$ minikube docker-env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.49.2:2376"
export DOCKER_CERT_PATH="/home/dave/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="minikube"

# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)