Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max Conroy SBA 2022 Kubernetes Cluster #9

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
33b9262
Added requirements.txt
max-conroy Jan 11, 2022
f028c41
Merge branch 'platformps:master' into master
max-conroy Jan 11, 2022
1cdce28
added kubernetes.yml
max-conroy Jan 11, 2022
3026cb7
Merge branch 'master' of github.com:max-conroy/sba2022.kubernetes-clu…
max-conroy Jan 11, 2022
7533640
Merge branch 'platformps:master' into master
max-conroy Jan 11, 2022
fe82c01
added Jenkinsfile
max-conroy Jan 11, 2022
5d1cd62
added Jenkinsfile
max-conroy Jan 11, 2022
f5ef437
Updated Jenkinsfile
max-conroy Jan 11, 2022
9805e26
Updated Jenkinsfile
max-conroy Jan 11, 2022
cbc4490
Updated Jenkinsfile
max-conroy Jan 11, 2022
2991573
Added Dockerfile
max-conroy Jan 11, 2022
3d4b8d6
Updated Jenkinsfile
max-conroy Jan 11, 2022
79a6533
Updated requirements.txt
max-conroy Jan 11, 2022
b4ca261
Updated Jenkinsfile
max-conroy Jan 11, 2022
a5ec4c9
Updated Jenkinsfile
max-conroy Jan 11, 2022
55873a8
Updated Jenkinsfile
max-conroy Jan 11, 2022
0b31ceb
Updated Jenkinsfile
max-conroy Jan 11, 2022
120859d
Updated Jenkinsfile
max-conroy Jan 11, 2022
61aa000
Updated Jenkinsfile
max-conroy Jan 11, 2022
4dedaee
Updated Jenkinsfile
max-conroy Jan 11, 2022
2ca3daa
Updated Jenkinsfile
max-conroy Jan 11, 2022
6df9056
Updated Jenkinsfile
max-conroy Jan 11, 2022
5d6dfd4
Updated Jenkinsfile
max-conroy Jan 11, 2022
3368685
Updated Jenkinsfile
max-conroy Jan 11, 2022
1700fc3
Updated Dockerfile
max-conroy Jan 11, 2022
15b1404
Updated Jenkinsfile
max-conroy Jan 11, 2022
418493b
Updated Jenkinsfile
max-conroy Jan 11, 2022
905eb53
Updated Jenkinsfile
max-conroy Jan 11, 2022
db03f35
Added submission folder containing items for SBA 2022 submission
max-conroy Jan 12, 2022
18353f5
Updated Dockerfile
max-conroy Jan 12, 2022
e77135b
Added browser screenshot of Flask app running
max-conroy Jan 12, 2022
e0d13cc
Link to Dockerhub repo
max-conroy Jan 12, 2022
9679db2
Added check-cluster.sh
max-conroy Jan 12, 2022
181b357
Merge branch 'master' of github.com:max-conroy/sba2022.kubernetes-clu…
max-conroy Jan 12, 2022
4981c31
Updated check-cluster.sh and directed its output to a file in submiss…
max-conroy Jan 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM python:3.7
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD python web.py
18 changes: 18 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pipeline {
agent any
stages {
stage('Docker Build') {
steps {
sh 'docker build -t conroy3644/sba2022.kube:latest .'
}
}
stage('Docker Push') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerHub', passwordVariable: 'dockerHubPassword', usernameVariable: 'dockerHubUser')]) {
sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPassword}"
sh 'docker push conroy3644/sba2022.kube:latest'
}
}
}
}
}
5 changes: 5 additions & 0 deletions check-cluster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

kubectl get pods >> /home/osboxes/sba2022.kubernetes-cluster/submission/check-cluster-output.txt
kubectl get nodes >> /home/osboxes/sba2022.kubernetes-cluster/submission/check-cluster-output.txt
kubectl get deployments >> /home/osboxes/sba2022.kubernetes-cluster/submission/check-cluster-output.txt
10 changes: 10 additions & 0 deletions kubernetes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Pod
metadata:
name: sba2022pod
spec:
containers:
- name: sba2022container
image: conroy3644/sba2022.kube:latest
ports:
- containerPort: 8080
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flask
flask_restful
Binary file added submission/SBA2022-Flask-on-Kubernetes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions submission/check-cluster-output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
NAME READY UP-TO-DATE AVAILABLE AGE
balanced 1/1 1 1 6d3h
hello-minikube 1/1 1 1 6d3h
NAME READY STATUS RESTARTS AGE
balanced-5744b548b4-jq7x6 1/1 Running 2 (30h ago) 6d3h
hello-minikube-6ddfcc9757-lzwcw 1/1 Running 2 (30h ago) 6d3h
mysql-client 1/1 Running 0 24h
sba2022pod 1/1 Running 0 8m10s
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane,master 6d4h v1.22.3
NAME READY UP-TO-DATE AVAILABLE AGE
balanced 1/1 1 1 6d3h
hello-minikube 1/1 1 1 6d3h
1 change: 1 addition & 0 deletions submission/dockerhub-repo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://hub.docker.com/repository/docker/conroy3644/sba2022.kube
143 changes: 143 additions & 0 deletions submission/jenkins-output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
This is Jenkins console output after successfully building image from local Dockerfile and pushing it to Dockerhub


Started by user Max C
Obtained Jenkinsfile from git https://github.com/max-conroy/sba2022.kubernetes-cluster.git
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/sba2022-job
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
No credentials specified
> git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/sba2022-job/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/max-conroy/sba2022.kubernetes-cluster.git # timeout=10
Fetching upstream changes from https://github.com/max-conroy/sba2022.kubernetes-cluster.git
> git --version # timeout=10
> git --version # 'git version 2.25.1'
> git fetch --tags --force --progress -- https://github.com/max-conroy/sba2022.kubernetes-cluster.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 905eb53be8d4516acafaafb3d6555193c0ce8521 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 905eb53be8d4516acafaafb3d6555193c0ce8521 # timeout=10
Commit message: "Updated Jenkinsfile"
> git rev-list --no-walk 418493be5d1513ef240f648b5549fb9a58ef35e0 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Docker Build)
[Pipeline] sh
+ docker build -t conroy3644/sba2022.kube:latest .
Sending build context to Docker daemon 7.495MB

Step 1/4 : FROM python:3.7
---> ad37de9b03ef
Step 2/4 : COPY . /app
---> 811e49bb0c8c
Step 3/4 : WORKDIR /app
---> Running in 9dfdcde94a35
Removing intermediate container 9dfdcde94a35
---> 88aedf98a729
Step 4/4 : RUN pip install -r requirements.txt
---> Running in 2d03125b577e
Collecting flask
Downloading Flask-2.0.2-py3-none-any.whl (95 kB)
Collecting flask_restful
Downloading Flask_RESTful-0.3.9-py2.py3-none-any.whl (25 kB)
Collecting Jinja2>=3.0
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
Collecting Werkzeug>=2.0
Downloading Werkzeug-2.0.2-py3-none-any.whl (288 kB)
Collecting click>=7.1.2
Downloading click-8.0.3-py3-none-any.whl (97 kB)
Collecting itsdangerous>=2.0
Downloading itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Collecting pytz
Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB)
Collecting six>=1.3.0
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting aniso8601>=0.82
Downloading aniso8601-9.0.1-py2.py3-none-any.whl (52 kB)
Collecting importlib-metadata
Downloading importlib_metadata-4.10.0-py3-none-any.whl (17 kB)
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (31 kB)
Collecting typing-extensions>=3.6.4
Downloading typing_extensions-4.0.1-py3-none-any.whl (22 kB)
Collecting zipp>=0.5
Downloading zipp-3.7.0-py3-none-any.whl (5.3 kB)
Installing collected packages: zipp, typing-extensions, MarkupSafe, importlib-metadata, Werkzeug, Jinja2, itsdangerous, click, six, pytz, flask, aniso8601, flask-restful
Successfully installed Jinja2-3.0.3 MarkupSafe-2.0.1 Werkzeug-2.0.2 aniso8601-9.0.1 click-8.0.3 flask-2.0.2 flask-restful-0.3.9 importlib-metadata-4.10.0 itsdangerous-2.0.1 pytz-2021.3 six-1.16.0 typing-extensions-4.0.1 zipp-3.7.0
1mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
1mWARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Removing intermediate container 2d03125b577e
---> f9776816f2e9
Successfully built f9776816f2e9
Successfully tagged conroy3644/sba2022.kube:latest
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Docker Push)
[Pipeline] withCredentials
Masking supported pattern matches of $dockerHubPassword
[Pipeline] {
[Pipeline] sh
Warning: A secret was passed to "sh" using Groovy String interpolation, which is insecure.
Affected argument(s) used the following variable(s): [dockerHubPassword]
See https://jenkins.io/redirect/groovy-string-interpolation for details.
+ docker login -u conroy3644 -p ****
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /var/lib/jenkins/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
[Pipeline] sh
+ docker push conroy3644/sba2022.kube:latest
The push refers to repository [docker.io/conroy3644/sba2022.kube]
d835b42882d7: Preparing
b75b9ca6595f: Preparing
11088eb5307c: Preparing
d86f8b9fa813: Preparing
86c81640d929: Preparing
aedcb370b058: Preparing
c3a0d593ed24: Preparing
26a504e63be4: Preparing
8bf42db0de72: Preparing
31892cc314cb: Preparing
11936051f93b: Preparing
aedcb370b058: Waiting
c3a0d593ed24: Waiting
26a504e63be4: Waiting
8bf42db0de72: Waiting
31892cc314cb: Waiting
11936051f93b: Waiting
86c81640d929: Layer already exists
d86f8b9fa813: Layer already exists
11088eb5307c: Layer already exists
aedcb370b058: Layer already exists
c3a0d593ed24: Layer already exists
26a504e63be4: Layer already exists
8bf42db0de72: Layer already exists
31892cc314cb: Layer already exists
11936051f93b: Layer already exists
b75b9ca6595f: Pushed
d835b42882d7: Pushed
latest: digest: sha256:49499265e3a1885f674f569622687937c4e5838e8068f1b8cf7aa3470078549e size: 2640
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS