#DEVops Task3

FROM centos
RUN yum install sudo -y
RUN sudo yum install wget -y
RUN yum install git -y


#Jenkins
RUN sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
RUN sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
RUN yum install java-11-openjdk.x86_64 -y
RUN yum install initscripts.x86_64 -y
RUN yum install jenkins -y
RUN echo -e "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers


#Kubernetes
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN cp ./kubectl /usr/local/bin/kubectl
RUN cp ./kubectl /usr/bin/
RUN mkdir /root/.kube
COPY client.key /root/.kube
COPY client.crt /root/.kube
COPY ca.crt /root/.kube
COPY config /root/.kube


CMD /etc/rc.d/init.d/jenkins start && /bin/bash
  1. First copy all the certificates of minikube inside the directory where your Dockerfile is present.
  2. You get this file from where you installed your minikube…
  3. I installed minikube in windows and I found these files at C:\Users\jainr\.minikube && C:\Users\jainr\.minikube\profiles\minikube.
  4. After copy creates a “config” file.
docker build -t <Image_name> .
docker run -dit -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker --name jenkins_task3 -v /:/Base_OS -p 1234:8080 dockerfile
apiVersion: v1
kind: Service
metadata:
name: http-server
spec:
selector:
type: http
type: NodePort
ports:
- port: 80
name: http
nodePort: 30000
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: http-pvc
labels:
name: httppvc


spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-deploy
labels:
type: http
spec:
selector:
matchLabels:
type: http
strategy:
type: Recreate
template:
metadata:
labels:
type: http
spec:
containers:
- image: httpd
name: httpd
ports:
- containerPort: 80
name: httpd
volumeMounts:
- name: httpd-storage
mountPath: /usr/local/apache2/htdocs/
volumes:
- name: httpd-storage
persistentVolumeClaim:
claimName: http-pvc
apiVersion: v1
kind: Service
metadata:
name: php-server
spec:
selector:
type: php
type: NodePort
ports:
- port: 80
name: php
nodePort: 31000
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: php-pvc
labels:
name: phppvc


spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-deploy
labels:
type: php
spec:
selector:
matchLabels:
type: php
strategy:
type: Recreate
template:
metadata:
labels:
type: php
spec:
containers:
- image: vimal13/apache-webserver-php
name: php
ports:
- containerPort: 80
name: php
volumeMounts:
- name: php-storage
mountPath: /var/www/html/
volumes:
- name: php-storage
persistentVolumeClaim:
claimName: php-pvc

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

C++ Libraries — Part II: Implementation

Getting Started with Hammer

More aggregation with less aggravation.

AZURE CLOUD PLATFORM -Function (Article 10)

Certifications for DevOps Engineers (while staying at home)

10 Practical Lessons Learnt from Implementing Microservices

Multi-stage Docker Builds in Golang with Go Modules

Cloning a private Github repo to your EC2 Instance.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jainrishabh

Jainrishabh

More from Medium

How To Build a CI/CD Pipeline In Azure DevOps ?

DevOps Explained Simply

Bundle Configuration in Salesforce CPQ