You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: part1.yml
+17-17
Original file line number
Diff line number
Diff line change
@@ -4,50 +4,50 @@ parts:
4
4
intro: In this part we will setup a local cluster with minikube, deploy a public image from dockerhub, customize that image, and then finally deploy it inside our local cluster.
- cap: Wait 20 seconds and view minikube dashboard
13
+
- cap: Wait 20 seconds, and then view the Minikube Dashboard, a web UI for managing deployments.
14
14
com: sleep 20; minikube service kubernetes-dashboard --namespace kube-system
15
15
16
-
- cap: Deploy the public nginx image from DockerHub
16
+
- cap: Deploy the public nginx image from DockerHub into a pod. Nginx is an open source web server that will automatically download from Docker Hub if it’s not available locally.
17
17
com: kubectl run nginx --image nginx --port 80
18
18
19
-
- cap: Create a service for deployment
19
+
- cap: Create a service for deployment. This will expose the nginx pod so you can access it with a web browser.
- cap: Launch a web browser to test the service. The nginx welcome page displays, which means the service is up and running.
23
23
com: minikube service nginx
24
24
25
-
- cap: Install registry
25
+
- cap: Set up the cluster registry by applying a .yml manifest file.
26
26
com: kubectl apply -f manifests/registry.yml
27
27
28
-
- cap: Wait for registry to deploy
28
+
- cap: Wait for the registry to finish deploying. Note that this may take several minutes.
29
29
com: kubectl rollout status deployments/registry
30
30
31
-
- cap: View registry UI
31
+
- cap: View the registry user interface in a web browser.
32
32
com: minikube service registry-ui
33
33
34
-
- cap: Edit the contents of applications/hello-kenzan/index.html. This will open the file with the nano editor. When finished press ctrl + x to exit and confirm save.
34
+
- cap: Let’s make a change to an HTML file in the cloned project. Running the command below will open /applications/hello-kenzan/index.html in the nano text editor. Change some text inside one of the <p> tags. For example, change “Hello from Kenzan!” to “Hello from Me!”. When you’re done, press Ctrl+X to close the file, type Y to confirm the filename, and press Enter to write the changes to the file.
35
35
com: nano applications/hello-kenzan/index.html
36
36
37
-
- cap: We will now build the image with a special name that is pointing at our cluster registry.
37
+
- cap: Now let’s build an image, giving it a special name that points to our local cluster registry.
- cap: Before we can push our image we need to set up a temporary proxy. This is a container that listens on 127.0.0.1:30400 and forwads to our cluster. By default the docker client can only push to non https via localhost.
40
+
- cap: We’ve built the image, but before we can push it to the registry, we need to set up a temporary proxy. By default the Docker client can only push to HTTP (not HTTPS) via localhost. To work around this, we’ll set up a container that listens on 127.0.0.1:30400 and forwards to our cluster.
- cap: The proxy’s work is done, so you can go ahead and stop it.
47
47
com: docker stop socat-registry;
48
48
49
-
- cap: Now that our image is on the cluster we can deploy the manifests
49
+
- cap: With the image in our cluster registry, the last thing to do is apply the manifest to create and deploy the hello-kenzan pod based on the image.
intro: In this part we will Setup Jenkins, and setup an automated job to build, push and deploy our custom appliction.
4
+
intro: In this part we will Setup Jenkins, and setup an automated pipeline to build, push and deploy our custom appliction.
5
5
steps:
6
6
7
-
- cap: Install Jenkins
7
+
- cap: Install Jenkins, which we’ll use to create our automated CI/CD pipeline. It will take the pod a minute or two to roll out.
8
8
com: kubectl apply -f manifests/jenkins.yml; kubectl rollout status deployment/jenkins
9
9
10
-
- cap: Open the Jenkins service running in our cluster. You will retrieve the admin password in the next step.
10
+
- cap: Open the Jenkins UI in a web browser.
11
11
com: minikube service jenkins
12
12
13
-
- cap: Get Jenkins admin password with the following command.
13
+
- cap: Display the Jenkins admin password with the following command, and right-click to copy it. IMPORTANT: BE CAREFUL NOT TO PRESS CTRL-C TO COPY THE PASSWORD AS THIS WILL STOP THE SCRIPT.
- cap: Enter the password above into the Jenkins page and choose to install the suggested plugins.
17
-
com: echo 'Enter the password above into the Jenkins page and choose to install the suggested plugins.'
16
+
- cap: Switch back to the Jenkins UI. Paste the Jenkins admin password in the box and click Continue. Click Install suggested plugins and wait for the process to complete.
17
+
com: echo ''
18
18
19
-
- cap: Create an admin user when prompted in Jenkins (or click the skip link in the lower right).
20
-
com: echo 'Create an admin user when prompted in Jenkins (or click the skip link in the lower right).'
19
+
- cap: Create an admin user and credentials, and click Save and Finish. (Make sure to remember these credentials as you will need them for repeated logins.) Click Start using Jenkins.
20
+
com: echo ''
21
21
22
-
- cap: Click "New Item" and create an item with a name like "Hello-Kenzan Pipeline", choosing the type "Pipeline". Click OK.
23
-
com: echo 'Click "New Item" and create an item with a name like "Hello-Kenzan Pipeline", choosing the type "Pipeline". Click OK.'
22
+
- cap: We now want to create a new pipeline for use with our Hello-Kenzan app. On the left, click New Item. Enter the item name as "Hello-Kenzan Pipeline", select Pipeline, and click OK.
23
+
com: echo ''
24
24
25
-
- cap: From pipeline configuration, scroll down to Pipeline and change the Definition selection from "Pipeline script" to "Pipeline script from SCM".
26
-
com: echo 'From pipeline configuration, scroll down to Pipeline and change the Definition selection from "Pipeline script" to "Pipeline script from SCM".'
25
+
- cap: Under the Pipeline section at the bottom, change the Definition to be "Pipeline script from SCM".
26
+
com: echo ''
27
27
28
-
- cap: Set the SCM property to GIT.
29
-
com: echo 'Set the SCM property to GIT.'
28
+
- cap: Change the SCM to Git.
29
+
com: echo ''
30
30
31
-
- cap: Fork the kenzanlabs repository in github and set the "Repository URL" to your fork, such as https://github.com/kenzanlabs/kubernetes-ci-cd.git. Save and run the job.
32
-
com: echo 'Fork the kenzanlabs repository in github and set the "Repository URL" to your fork, such as https://github.com/kenzanlabs/kubernetes-ci-cd.git. Save and run the job.'
31
+
- cap: Change the Repository URL to be the URL of your forked Git repository, such as https://github.com/[GIT USERNAME]/kubernetes-ci-cd. Click Save. On the left, click Build Now to run the new pipeline.
32
+
com: echo ''
33
33
34
-
- cap: View updated application
34
+
- cap: Now view the Hello-Kenzan application.
35
35
com: minikube service hello-kenzan
36
36
37
-
- cap: Push a change to your fork. Run job again. View changes
37
+
- cap: Push a change to your fork. Run job again. View the changes.
Copy file name to clipboardExpand all lines: part3.yml
+21-21
Original file line number
Diff line number
Diff line change
@@ -4,65 +4,65 @@ parts:
4
4
intro: This part will have us setup the various applications that will present the crossword puzzle. We will run a sample etcd cluster as a cache, a pages application containing the front-end, a crossword server using mongodb, and a monitoring and scaling server application.
5
5
steps:
6
6
7
-
- cap: Bootstrap etcd operator on the cluster
7
+
- cap: Start the etcd operator and service on the cluster. You may notice errors showing up as it is waiting to start up the cluster. This is normal until it starts.
8
8
com: scripts/etcd.sh
9
9
10
-
- cap: Run job to create etcd directory
10
+
- cap: Now that we have an etcd service, we need an etcd client. The following command will set up a directory within etcd for storing key-value pairs, and then run the etcd client.
11
11
com: kubectl create -f manifests/etcd-job.yml
12
12
13
-
- cap: Check job status
13
+
- cap: Check the status of the job in step 2 to make sure it deployed.
14
14
com: kubectl describe jobs/etcd-job
15
15
16
-
- cap: The crossword application is a multi-tier application and its services depend on each other. For our first step we will create the 3 services ahead of time so that the deployments are already aware of them later.
16
+
- cap: The crossword application is a multi-tier application whose services depend on each other. We will create three services in Kubernetes ahead of time, so that the deployments are aware of them.
17
17
com: kubectl apply -f manifests/all-services.yml
18
18
19
-
- cap: Now we're going to walk through an initial build of the monitoring and scaling service for our crosswords application.
19
+
- cap: Now we're going to walk through an initial build of the monitor-scale service.
- cap: Wait for the monitor-scale deployment to finish.
38
38
com: kubectl rollout status deployment/monitor-scale
39
39
40
-
- cap: See the montior-scale-* pod running using kubectl.
40
+
- cap: View pods to see the monitor-scale pod running.
41
41
com: kubectl get pods
42
42
43
-
- cap: See the montior-scale-* service is setup using kubectl.
43
+
- cap: View services to see the monitor-scale service.
44
44
com: kubectl get services
45
45
46
-
- cap: See the montior-scale-* ingress is configured using kubectl.
46
+
- cap: View ingress rules to see the monitor-scale ingress rule.
47
47
com: kubectl get ingress
48
48
49
-
- cap: See the monitor-scale deployment is setup using kubectl
49
+
- cap: View deployments to see the monitor-scale deployment.
50
50
com: kubectl get deployments
51
51
52
-
- cap: Now we will bootstrap the crossword/mongodb services, creating a docker image and storing it in the local registry. This script runs the same steps as before for a different service application.
52
+
- cap: We will run a script to bootstrap the puzzle and mongo services, creating Docker images and storing them in the local registry. The puzzle.sh script runs through the same build, proxy, push, and deploy steps we just ran through manually for both services.
53
53
com: scripts/puzzle.sh
54
54
55
-
- cap: Check to see if the puzzle service has been deployed
55
+
- cap: Check to see if the puzzle and mongo services have been deployed.
56
56
com: kubectl rollout status deployment/puzzle
57
57
58
-
- cap: Bootstrap the frontend web application. This script follows the same steps as before but
58
+
- cap: Bootstrap the kr8sswordz frontend web application. This script follows the same build proxy, push, and deploy steps that the other services followed.
59
59
com: scripts/kr8sswordz-pages.sh
60
60
61
-
- cap: Check to see if the front end has been deployed
61
+
- cap: Check to see if the frontend has been deployed.
62
62
com: kubectl rollout status deployment/kr8sswordz
63
63
64
-
- cap: See all the pods running using kubectl.
64
+
- cap: Check out all the pods that are running.
65
65
com: kubectl get pods
66
66
67
-
- cap: Start the web application in your default browser
67
+
- cap: Start the web application in your default browser. You may have to refresh your browser so that the puzzle appears properly.
intro: In this part we will return to our Jenkins instance and setup jobs for each component of the kr8sswordz application.
4
+
intro: In this part we will return to our Jenkins instance and setup a pipeline for the kr8sswordz application.
5
5
steps:
6
6
7
-
- cap: Open the Jenkins service running in our cluster.
7
+
- cap: Enter the following command to open the Jenkins UI in a web browser. Log in to Jenkins using the username and password you previously set up.
8
8
com: minikube service jenkins
9
9
10
-
- cap: Login as admin, if necessary.
11
-
com: echo 'Login as admin, if necessary.'
10
+
- cap: We’ll want to create a new pipeline for the puzzle service that we previously deployed. On the left in Jenkins, click New Item.
11
+
com: echo ''
12
+
13
+
- cap: Enter the item name as "Puzzle-Service", click Pipeline, and click OK.
14
+
com: echo ''
12
15
13
-
- cap: Click "New Item" and create an item with a name like "Puzzle Service Pipeline", choosing the type "Pipeline". Click OK.
14
-
com: echo 'Click "New Item" and create an item with a name like "Puzzle Service Pipeline", choosing the type "Pipeline". Click OK.'
16
+
- cap: Under the Build Triggers section, select Poll SCM. For the Schedule, enter the the string H/5 * * * * which will poll the Git repo every 5 minutes for changes.
17
+
com: echo ''
15
18
16
-
- cap: From pipeline configuration, scroll down to Pipeline and change the Definition selection from "Pipeline script" to "Pipeline script from SCM".
17
-
com: echo 'From pipeline configuration, scroll down to Pipeline and change the Definition selection from "Pipeline script" to "Pipeline script from SCM".'
19
+
- cap: In the Pipeline section, and change the Definition to "Pipeline script from SCM". Set the SCM property to GIT. Set the Repository URL to your forked repo (created in Part 2), such as https://github.com/[GIT USERNAME]/kubernetes-ci-cd.git. Set the Script Path to applications/puzzle/Jenkinsfile
20
+
com: echo ''
18
21
19
-
- cap: Set the SCM property to GIT.
20
-
com: echo 'Set the SCM property to GIT.'
22
+
- cap: When you are finished, click Save. On the left, click Build Now to run the new pipeline. You should see it successfully run through the build, push, and deploy steps in a few minutes.
23
+
com: echo ''
21
24
22
-
- cap: Set the "Repository URL" to your fork (created in Part 2), such as https://github.com/kenzanlabs/kubernetes-ci-cd.git.
23
-
com: echo 'Set the "Repository URL" to your fork (created in Part 2), such as https://github.com/kenzanlabs/kubernetes-ci-cd.git.'
24
-
25
-
- cap: Set the "Script Path" to applications/puzzle/Jenkinsfile
26
-
com: echo 'Set the "Script Path" to applications/puzzle/Jenkinsfile'
27
-
28
-
- cap: Save and run the job using the "Build Now" button.
29
-
com: echo 'Save and run the job using the "Build Now" button.'
30
-
31
-
- cap: View updated application
25
+
- cap: View the Kr8sswordz application.
32
26
com: minikube service kr8sswordz
27
+
28
+
- cap: Spin up several instances of the puzzle service by moving the slider to the right and clicking Scale. For reference, click on the Submit button, noting that the green hit does not register on the puzzle services.
29
+
com: echo ''
33
30
34
-
- cap: Edit the contents of 'applications/puzzle/common/crossword.js' by uncommenting line 43. This will open the file with the nano editor. When finished press ctrl + x to exit and confirm save.
35
-
com: nano applications/puzzle/common/crossword.js
31
+
- cap: Edit applications/puzzle/common/models/crossword.js in the nano editor. You'll see a commented section on lines 42-43 that indicates to uncomment a specific line. Uncomment line 43. Press Ctrl+X to close the file, type Y to confirm the filename, and Enter to save the changes to the file.
0 commit comments