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

sultana-sba-kube #14

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 srafique001/sba-kebe-2022: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 srafique001/sba-kebe-2022:latest'
}
}
}
}
}
Binary file added Screenshot (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions ckeck-output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

minikube kubectl get pods >> output.txt
minikube kubectl get nodes >> output.txt
minikube kubectl get deployments >> output.txt
145 changes: 145 additions & 0 deletions jenkins-image-built.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
Console Output
Started by user jenkins
Obtained Jenkinsfile from git https://github.com/SultanaRafique/sba2022.kubernetes-cluster.git
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/sba-kubernetes-2022
[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/sba-kubernetes-2022/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/SultanaRafique/sba2022.kubernetes-cluster.git # timeout=10
Fetching upstream changes from https://github.com/SultanaRafique/sba2022.kubernetes-cluster.git
> git --version # timeout=10
> git --version # 'git version 2.25.1'
> git fetch --tags --force --progress -- https://github.com/SultanaRafique/sba2022.kubernetes-cluster.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 888d6c59cafce0c4bebd716260799b967cab4a30 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 888d6c59cafce0c4bebd716260799b967cab4a30 # timeout=10
Commit message: " initial commit"
> git rev-list --no-walk 888d6c59cafce0c4bebd716260799b967cab4a30 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Docker Build)
[Pipeline] sh
+ docker build -t srafique001/sba-kebe-2022:latest .
Sending build context to Docker daemon 7.39MB

Step 1/5 : FROM python:3.7
---> ad37de9b03ef
Step 2/5 : COPY . /app
---> 2610bf970221
Step 3/5 : WORKDIR /app
---> Running in d83efd8b4619
Removing intermediate container d83efd8b4619
---> 4398e8bd70cb
Step 4/5 : RUN pip install -r requirements.txt
---> Running in c98f02365ee3
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 itsdangerous>=2.0
Downloading itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Collecting click>=7.1.2
Downloading click-8.0.3-py3-none-any.whl (97 kB)
Collecting Werkzeug>=2.0
Downloading Werkzeug-2.0.2-py3-none-any.whl (288 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 pytz
Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB)
Collecting importlib-metadata
Downloading importlib_metadata-4.10.1-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 zipp>=0.5
Downloading zipp-3.7.0-py3-none-any.whl (5.3 kB)
Collecting typing-extensions>=3.6.4
Downloading typing_extensions-4.0.1-py3-none-any.whl (22 kB)
Installing collected packages: zipp, typing-extensions, MarkupSafe, importlib-metadata, Werkzeug, Jinja2, itsdangerous, click, six, pytz, flask, aniso8601, flask-restful
WARNING: 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
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.1 itsdangerous-2.0.1 pytz-2021.3 six-1.16.0 typing-extensions-4.0.1 zipp-3.7.0
WARNING: 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 c98f02365ee3
---> 327fc8645e08
Step 5/5 : CMD python web.py
---> Running in c54496fca8d7
Removing intermediate container c54496fca8d7
---> 8941c5d00809
Successfully built 8941c5d00809
Successfully tagged srafique001/sba-kebe-2022: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 srafique001 -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 srafique001/sba-kebe-2022:latest
The push refers to repository [docker.io/srafique001/sba-kebe-2022]
b21fef241266: Preparing
2dd0a5e76e93: Preparing
11088eb5307c: Preparing
d86f8b9fa813: Preparing
86c81640d929: Preparing
aedcb370b058: Preparing
c3a0d593ed24: Preparing
26a504e63be4: Preparing
8bf42db0de72: Preparing
31892cc314cb: Preparing
11936051f93b: Preparing
c3a0d593ed24: Waiting
26a504e63be4: Waiting
8bf42db0de72: Waiting
31892cc314cb: Waiting
11936051f93b: Waiting
aedcb370b058: Waiting
d86f8b9fa813: Mounted from library/python
11088eb5307c: Mounted from library/python
86c81640d929: Mounted from library/python
aedcb370b058: Mounted from library/python
c3a0d593ed24: Mounted from library/python
26a504e63be4: Mounted from library/python
31892cc314cb: Mounted from library/python
8bf42db0de72: Mounted from library/python
11936051f93b: Mounted from library/python
2dd0a5e76e93: Pushed
b21fef241266: Pushed
latest: digest: sha256:a18a8680ee68bc0b312e042e1a80c8e1f28bf0fd5ae273f6b5ab5743f8b86e67 size: 2641
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
21 changes: 21 additions & 0 deletions kubernetes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sba2022deploy
labels:
app: sba2022app
spec:
replicas: 3
selector:
matchLabels:
app: sba2022app
template:
metadata:
labels:
app: sba2022app
spec:
containers:
- name: sba2022pod
image: srafique001/sba-kebe-2022:latest
ports:
- containerPort: 8080
8 changes: 8 additions & 0 deletions output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NAME READY STATUS RESTARTS AGE
sba2022deploy-7dc8764d9-5xqtt 1/1 Running 0 22m
sba2022deploy-7dc8764d9-vg6tl 1/1 Running 0 17m
sba2022deploy-7dc8764d9-zx5dc 1/1 Running 0 17m
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane,master 33m v1.22.3
NAME READY UP-TO-DATE AVAILABLE AGE
sba2022deploy 3/3 3 3 26m
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