Skip to content

Instantly share code, notes, and snippets.

@prtha112
Last active August 15, 2022 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prtha112/b957fb5e89f9df26e2227418a7634c41 to your computer and use it in GitHub Desktop.
Save prtha112/b957fb5e89f9df26e2227418a7634c41 to your computer and use it in GitHub Desktop.
sample-app-kub
---
apiVersion: apps/v1
kind: Deployment # Type of Kubernetes resource
metadata:
name: sample-app # Name of the Kubernetes resource
spec:
replicas: 3 # Number of pods to run at any given time
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
selector:
matchLabels:
app: sample-app # This deployment applies to any Pods matching the specified label
template: # This deployment will create a set of pods using the configurations in this template
metadata:
labels: # The labels that will be applied to all of the pods in this deployment
app: sample-app
spec: # Spec for the container which will run in the Pod
containers:
- name: sample-app
image: gcr.io/google-samples/node-hello:1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080 # Should match the port number that the Go application listens on
---
apiVersion: v1
kind: Service # Type of kubernetes resource
metadata:
name: sample-app # Name of the resource
spec:
type: NodePort
ports: # Take incoming HTTP requests on port 9090 and forward them to the targetPort of 8080
- name: http
protocol: TCP
port: 80
targetPort: 8080
selector:
app: sample-app
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sample-app
spec:
defaultBackend:
service:
name: sample-app
port:
number: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample-app
spec:
replicas: 3
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
selector:
matchLabels:
app: sample-app
template:
metadata:
labels:
app: sample-app
spec:
containers:
- name: sample-app
image: gcr.io/google-samples/node-hello:1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sample-app
spec:
defaultBackend:
service:
name: sample-app
port:
number: 80
---
apiVersion: v1
kind: Service
metadata:
name: sample-app
spec:
type: NodePort
ports:
- name: http
protocol: TCP
port: 80
targetPort: 8080
selector:
app: sample-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment