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

mamoun janfor #13

Open
wants to merge 21 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
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python

FROM python

COPY . /app

WORKDIR /app

RUN pip install -r requirements.txt

CMD ["python","web.py"]


25 changes: 25 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pipeline {
agent any
stages {
stage('Clone Repository') {
steps {
checkout scm
}
}
stage('Build Image') {
steps {
sh "docker build -t 19841022/test3 ."
}
}
stage('Push image') {
steps {
sh 'docker push 19841022/test3'
}
}
stage('Testing') {
steps {
echo 'Testing...'
}
}
}
}
Binary file added flask-spinning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
143 changes: 143 additions & 0 deletions jenkins-building-puching-image.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
Started by user mamoun janfor
Obtained Jenkinsfile from git https://github.com/mamounjanfor/sba2022.kubernetes-cluster.git
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/test-pipline
[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/test-pipline/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/mamounjanfor/sba2022.kubernetes-cluster.git # timeout=10
Fetching upstream changes from https://github.com/mamounjanfor/sba2022.kubernetes-cluster.git
> git --version # timeout=10
> git --version # 'git version 2.25.1'
> git fetch --tags --force --progress -- https://github.com/mamounjanfor/sba2022.kubernetes-cluster.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision c8f275d9d3a1fd37febc518fb3f4246a37dcc639 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f c8f275d9d3a1fd37febc518fb3f4246a37dcc639 # timeout=10
Commit message: "Update Jenkinsfile"
> git rev-list --no-walk c8f275d9d3a1fd37febc518fb3f4246a37dcc639 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Clone Repository)
[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/test-pipline/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/mamounjanfor/sba2022.kubernetes-cluster.git # timeout=10
Fetching upstream changes from https://github.com/mamounjanfor/sba2022.kubernetes-cluster.git
> git --version # timeout=10
> git --version # 'git version 2.25.1'
> git fetch --tags --force --progress -- https://github.com/mamounjanfor/sba2022.kubernetes-cluster.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision c8f275d9d3a1fd37febc518fb3f4246a37dcc639 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f c8f275d9d3a1fd37febc518fb3f4246a37dcc639 # timeout=10
Commit message: "Update Jenkinsfile"
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build Image)
[Pipeline] sh
+ docker build -t 19841022/test3 .
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
Sending build context to Docker daemon 7.267MB

Step 1/5 : FROM python
---> a5d7930b60cc
Step 2/5 : COPY . /app
---> Using cache
---> ab468211af1d
Step 3/5 : WORKDIR /app
---> Using cache
---> ac1516f6d32f
Step 4/5 : RUN pip install -r requirements.txt
---> Running in e3fcd53062c5
Collecting Flask==0.12
Downloading Flask-0.12-py2.py3-none-any.whl (82 kB)
Collecting Werkzeug>=0.7
Downloading Werkzeug-2.0.2-py3-none-any.whl (288 kB)
Collecting itsdangerous>=0.21
Downloading itsdangerous-2.0.1-py3-none-any.whl (18 kB)
Collecting click>=2.0
Downloading click-8.0.3-py3-none-any.whl (97 kB)
Collecting Jinja2>=2.4
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
Installing collected packages: MarkupSafe, Werkzeug, Jinja2, itsdangerous, click, Flask
Successfully installed Flask-0.12 Jinja2-3.0.3 MarkupSafe-2.0.1 Werkzeug-2.0.2 click-8.0.3 itsdangerous-2.0.1
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
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 e3fcd53062c5
---> 557b03f3d07b
Step 5/5 : CMD ["python"," web.py"]
---> Running in 81356eb1eae9
Removing intermediate container 81356eb1eae9
---> d53767e81f6f
Successfully built d53767e81f6f
Successfully tagged 19841022/test3:latest
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Push image)
[Pipeline] sh
+ docker push 19841022/test3
WARNING: Support for the legacy ~/.dockercfg configuration file and file-format is deprecated and will be removed in an upcoming release
Using default tag: latest
The push refers to repository [docker.io/19841022/test3]
870581083ac7: Preparing
d015f854b6f5: Preparing
db8d0fe6cf95: Preparing
00901a4c6fc7: Preparing
7e7decd61f68: 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
00901a4c6fc7: Mounted from 19841022/sba-image
db8d0fe6cf95: Mounted from 19841022/sba-image
7e7decd61f68: Mounted from 19841022/sba-image
c3a0d593ed24: Mounted from 19841022/sba-image
aedcb370b058: Mounted from 19841022/sba-image
26a504e63be4: Mounted from 19841022/sba-image
8bf42db0de72: Mounted from 19841022/sba-image
31892cc314cb: Mounted from 19841022/sba-image
d015f854b6f5: Pushed
11936051f93b: Mounted from 19841022/sba-image
870581083ac7: Pushed
latest: digest: sha256:37f2a597df2a0c8c7f7125161575948c2b39fb4bcedc2e805fceba60966e0495 size: 2640
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Testing)
[Pipeline] echo
Testing...
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
25 changes: 25 additions & 0 deletions kuberenetes-cluster-information-output
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Kubernetes control plane is running at https://127.0.0.1:56529
CoreDNS is running at https://127.0.0.1:56529/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 18h
NAME READY STATUS RESTARTS AGE
myapp-deployment-788df4f5cb-6bdsz 1/1 Running 0 4m58s
myapp-deployment-788df4f5cb-ns2hc 1/1 Running 19 (6h44m ago) 7h54m
myapp-deployment-788df4f5cb-w6fg2 1/1 Running 0 5m4s
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
myapp-deployment-788df4f5cb-6bdsz 1/1 Running 0 4m59s 172.17.0.7 minikube <none> <none>
myapp-deployment-788df4f5cb-ns2hc 1/1 Running 19 (6h44m ago) 7h54m 172.17.0.5 minikube <none> <none>
myapp-deployment-788df4f5cb-w6fg2 1/1 Running 0 5m5s 172.17.0.4 minikube <none> <none>
NAME READY STATUS RESTARTS AGE
myapp-deployment-788df4f5cb-6bdsz 1/1 Running 0 4m59s
myapp-deployment-788df4f5cb-ns2hc 1/1 Running 19 (6h44m ago) 7h54m
myapp-deployment-788df4f5cb-w6fg2 1/1 Running 0 5m5s
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane,master 18h v1.22.3
NAME DESIRED CURRENT READY AGE
myapp-deployment-648556c797 0 0 0 8h
myapp-deployment-6cff96fc46 0 0 0 7h37m
myapp-deployment-788df4f5cb 3 3 3 7h54m
192.168.49.2
10 changes: 10 additions & 0 deletions kubernetes-cluster-information.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash

kubectl cluster-info
kubectl get services
kubectl get pods
kubectl get pod -o wide
kubectl get pods -l app=myapp
kubectl get nodes
kubectl get replicaset
minikube ip
21 changes: 21 additions & 0 deletions kubernetes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
spec:
selector:
matchLabels:
app: myapp
replicas: 3 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: 19841022/sba-image
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask==0.12