|
| 1 | +# Workshop prerequisite |
| 2 | + |
| 3 | +Note: Recommended to setup these labs in your thoughtworks laptop. Also you need to have a good internet connection (mobile internet connection won’t be enough). |
| 4 | + |
| 5 | +## PreRead |
| 6 | + |
| 7 | +- Basic Jenkins Pipeline as a code knowledge (if completely new to pipeline as code, check this https://www.youtube.com/watch?v=s73nhwYBtzE ) |
| 8 | +- Docker Basics (if you are new to docker - please watch these ROTC recordings - https://www.youtube.com/playlist?list=PLknOipHZHwwVAM2lIKMXcy7HdEoqk0Ep1 ) |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +- Install Homebrew |
| 13 | + |
| 14 | + ``` |
| 15 | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 16 | + ``` |
| 17 | + |
| 18 | +- Install Command Line Tools for Mac |
| 19 | + |
| 20 | + ``` |
| 21 | + sudo xcode-select --install |
| 22 | + ``` |
| 23 | + |
| 24 | +- Install Minikube v1.24 |
| 25 | + |
| 26 | + ``` |
| 27 | + brew install hyperkit |
| 28 | + brew install minikube |
| 29 | + ``` |
| 30 | + |
| 31 | +- Verify Minikube and kubectl version |
| 32 | + |
| 33 | + ``` |
| 34 | + ~ ❯ minikube version |
| 35 | + minikube version: v1.24.0 |
| 36 | + commit: 76b94fb3c4e8ac5062daf70d60cf03ddcc0a741b |
| 37 | + ~ ❯ kubectl version |
| 38 | + Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:33:37Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"darwin/amd64"} |
| 39 | + ``` |
| 40 | + |
| 41 | +- Install Helm v3.7.2 |
| 42 | + ``` |
| 43 | + brew install helm |
| 44 | + ``` |
| 45 | +- Add additional repositories for helm |
| 46 | + ``` |
| 47 | + helm repo add jenkins https://charts.jenkins.io |
| 48 | + helm repo add evryfs-oss https://evryfs.github.io/helm-charts/ |
| 49 | + helm repo update |
| 50 | + ``` |
| 51 | +- Install Java 17 |
| 52 | + |
| 53 | + ``` |
| 54 | + brew install openjdk@17 |
| 55 | + ``` |
| 56 | + |
| 57 | +- Install Maven 3.8 |
| 58 | + |
| 59 | + ``` |
| 60 | + brew install maven |
| 61 | + ``` |
| 62 | + |
| 63 | +- Install Anchore Syft and Grype |
| 64 | + |
| 65 | + ``` |
| 66 | + brew tap anchore/syft |
| 67 | + brew install syft |
| 68 | + brew tap anchore/grype |
| 69 | + brew install grype |
| 70 | + ``` |
| 71 | + |
| 72 | +- Install Dockle |
| 73 | + |
| 74 | + ``` |
| 75 | + brew install goodwithtech/r/dockle |
| 76 | + Install Bridgecrew Checkov, |
| 77 | + brew install checkov |
| 78 | + ``` |
| 79 | + |
| 80 | +## Setup |
| 81 | + |
| 82 | +- Start Minikube |
| 83 | + |
| 84 | + ``` |
| 85 | + minikube start --nodes=1 --cpus=4 --memory 8192 --disk-size=35g --embed-certs=true --driver=hyperkit |
| 86 | + ``` |
| 87 | + |
| 88 | + E.g, |
| 89 | + |
| 90 | + ``` |
| 91 | + ~ ❯ minikube start --nodes=1 --cpus=4 --memory 8192 --disk-size=35g --embed-certs=true --driver=hyperkit |
| 92 | + 😄 minikube v1.24.0 on Darwin 12.1 |
| 93 | + ✨ Using the hyperkit driver based on user configuration |
| 94 | + 👍 Starting control plane node minikube in cluster minikube |
| 95 | + 🔥 Creating hyperkit VM (CPUs=4, Memory=8192MB, Disk=35840MB) ... |
| 96 | + 🐳 Preparing Kubernetes v1.22.3 on Docker 20.10.8 ... |
| 97 | + ▪ Generating certificates and keys ... |
| 98 | + ▪ Booting up control plane ... |
| 99 | + ▪ Configuring RBAC rules ... |
| 100 | + 🔎 Verifying Kubernetes components... |
| 101 | + ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5 |
| 102 | + 🌟 Enabled addons: storage-provisioner, default-storageclass |
| 103 | + 🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default |
| 104 | + ~ ❯ |
| 105 | + ``` |
| 106 | + |
| 107 | +- Check minikube installation |
| 108 | + |
| 109 | + ``` |
| 110 | + kubectl get pods --all-namespaces |
| 111 | + ``` |
| 112 | + |
| 113 | + E.g, |
| 114 | + |
| 115 | + ``` |
| 116 | + ~ ❯ kubectl get pods --all-namespaces |
| 117 | + NAMESPACE NAME READY STATUS RESTARTS AGE |
| 118 | + kube-system coredns-78fcd69978-zqqk7 1/1 Running 0 43s |
| 119 | + kube-system etcd-minikube 1/1 Running 0 56s |
| 120 | + kube-system kube-apiserver-minikube 1/1 Running 0 56s |
| 121 | + kube-system kube-controller-manager-minikube 1/1 Running 0 56s |
| 122 | + kube-system kube-proxy-gk2rt 1/1 Running 0 43s |
| 123 | + kube-system kube-scheduler-minikube 1/1 Running 0 56s |
| 124 | + kube-system storage-provisioner 1/1 Running 0 55s |
| 125 | + ~ ❯ |
| 126 | + ``` |
| 127 | + |
| 128 | +- Create a file with name “jenkins-values.yaml” and below contents |
| 129 | + |
| 130 | + ``` |
| 131 | + # Custom values for jenkins. |
| 132 | + controller: |
| 133 | + # List of plugins to be installed during Jenkins controller start |
| 134 | + installPlugins: |
| 135 | + - kubernetes:1.30.1 |
| 136 | + - kubernetes-client-api:5.4.1 |
| 137 | + - workflow-aggregator:2.6 |
| 138 | + - git:4.10.1 |
| 139 | + - configuration-as-code:1.55 |
| 140 | + - blueocean:latest |
| 141 | + - dependency-check-jenkins-plugin:latest |
| 142 | + - dependency-track:latest |
| 143 | + - warnings-ng:latest |
| 144 | + ``` |
| 145 | + |
| 146 | +- Install Jenkins |
| 147 | + |
| 148 | + ``` |
| 149 | + helm install jenkins jenkins/jenkins -f jenkins-values.yaml |
| 150 | + ``` |
| 151 | + |
| 152 | +- Wait for the jenkins pod to start |
| 153 | + |
| 154 | + ``` |
| 155 | + kubectl get pods --all-namespaces |
| 156 | + ``` |
| 157 | + |
| 158 | +- Get admin user password of Jenkins |
| 159 | + |
| 160 | + ``` |
| 161 | + kubectl exec --namespace default -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/chart-admin-password && echo |
| 162 | + ``` |
| 163 | + |
| 164 | + Note: Make a note of the password |
| 165 | + |
| 166 | +- Forward Jenkins server port to access from local machine |
| 167 | + kubectl --namespace default port-forward svc/jenkins 8080:8080 |
| 168 | +- open http://localhost:8080 |
| 169 | +- Login with username “admin” and the password from the above step. |
| 170 | + |
| 171 | +### [Optional] |
| 172 | + |
| 173 | +- Pull the below docker images to avoid pulling images during workshop |
| 174 | + ``` |
| 175 | + > minikube ssh |
| 176 | + > $ docker pull gradle:7-jdk17-alpine |
| 177 | + > $ docker pull openjdk:17.0.1 |
| 178 | + > $ docker pull rmkanda/docker-tools:latest |
| 179 | + > $ docker pull licensefinder/license_finder |
| 180 | + > $ docker pull rmkanda/trufflehog |
| 181 | + ``` |
0 commit comments