Last active
June 8, 2024 12:30
-
-
Save jimi008/994c8c20962e733c5e3f0ff4a92ddd87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: firstdeploy | |
labels: | |
name: firstdeploy | |
annotations: | |
kubernetes.io/change-cause: "first deployment" | |
spec: | |
replicas: 10 | |
minReadySeconds: 5 | |
strategy: | |
type: RollingUpdate | |
rollingUpdate: | |
maxSurge: 2 | |
maxUnavailable: 0 | |
selector: | |
matchLabels: | |
app: myapp | |
template: | |
metadata: | |
name: dpod | |
labels: | |
app: myapp | |
env: prod | |
spec: | |
containers: | |
- name: container | |
image: coolgourav147/nginx-custom:v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-config | |
data: | |
default.conf: | | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
root /usr/share/nginx/html; | |
index custom_index.html; | |
} | |
} | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-html | |
data: | |
custom_index.html: | | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Welcome to Pod: ${POD_NAME}</title> | |
</head> | |
<body> | |
<h1>This is Pod: ${POD_NAME}</h1> | |
</body> | |
</html> | |
--- | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: rcontroller-nginx | |
spec: | |
replicas: 3 | |
selector: | |
app: nginx | |
template: | |
metadata: | |
name: nginx-pod | |
labels: | |
app: nginx | |
env: prod | |
spec: | |
containers: | |
- name: nginx-container | |
image: nginx | |
command: ["/bin/sh", "-c"] | |
args: | |
- "envsubst < /etc/nginx/html/custom_index.html > /usr/share/nginx/html/index.html && nginx -g 'daemon off;'" | |
ports: | |
- containerPort: 80 | |
env: | |
- name: POD_NAME | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.name | |
volumeMounts: | |
- name: html | |
mountPath: /etc/nginx/html | |
- name: config | |
mountPath: /etc/nginx/conf.d/default.conf | |
subPath: default.conf | |
volumes: | |
- name: html | |
configMap: | |
name: nginx-html | |
items: | |
- key: custom_index.html | |
path: custom_index.html | |
- name: config | |
configMap: | |
name: nginx-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: staging-deploy | |
name: staging-deploy | |
spec: | |
progressDeadlineSeconds: 600 | |
replicas: 1 | |
revisionHistoryLimit: 10 | |
selector: | |
matchLabels: | |
app: staging-deploy | |
strategy: | |
rollingUpdate: | |
maxSurge: 25% | |
maxUnavailable: 25% | |
type: RollingUpdate | |
template: | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: staging-deploy | |
spec: | |
containers: | |
- image: node:10.15.3 | |
imagePullPolicy: Always | |
name: node | |
command: ["/bin/sh", "-c"] | |
args: | |
- | | |
git clone https://github.com/GermaVinsmoke/bmi-calculator | |
cd bmi-calculator | |
npm install | |
npm start | |
ports: | |
- containerPort: 3000 | |
resources: {} | |
terminationMessagePath: /dev/termination-log | |
terminationMessagePolicy: File | |
dnsPolicy: ClusterFirst | |
restartPolicy: Always | |
schedulerName: default-scheduler | |
securityContext: {} | |
terminationGracePeriodSeconds: 30 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: react-app-service | |
spec: | |
selector: | |
app: staging-deploy | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 3000 | |
nodePort: 30080 | |
type: NodePort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment