🚀 DevOps & SRE Certification Program 📅 Starting: 1st of Every Month 🤝 +91 8409492687 🔍 Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Knative Tutorials – Chapter 8 – Autoscaling applications with Knative

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: greeter
spec:
template:
spec:
containers:
- image: quay.io/rhdevelopers/knative-tutorial-greeter:quarkus
livenessProbe:
httpGet:
path: /healthz
readinessProbe:
httpGet:
path: /healthz
Service with concurrency of 10 requests
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: prime-generator
spec:
template:
metadata:
annotations:
# Target 10 in-flight-requests per pod.
autoscaling.knative.dev/target: "10"
spec:
containers:
- image: quay.io/rhdevelopers/prime-generator:v27-quarkus
livenessProbe:
httpGet:
path: /healthz
readinessProbe:
httpGet:
path: /healthz
The deployment of this service will always have a minimum of 2 pods.
Will allow each service pod to handle max of 10 in-flight requests per pod before automatically scaling to new pods.
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: prime-generator
spec:
template:
metadata:
annotations:
# the minimum number of pods to scale down to
autoscaling.knative.dev/minScale: "2"
# Target 10 in-flight-requests per pod.
autoscaling.knative.dev/target: "10"
spec:
containers:
- image: quay.io/rhdevelopers/prime-generator:v27-quarkus
livenessProbe:
httpGet:
path: /healthz
readinessProbe:
httpGet:
path: /healthz
Example - 1
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: cli-d0ef60fa-5c06-40d5-a8f3-24ea1d322335-1
namespace: knative-apps-deploy
labels:
serving.knative.dev/visibility: cluster-local
appid: d0ef60fa-5c06-40d5-a8f3-24ea1d322335
buildid: bl-63e2c7ad-ce41-4aac-b5ce-261ac968e71c
spec:
template:
#metadata:
# annotations:
# autoscaling.knative.dev/minScale: "0"
# autoscaling.knative.dev/maxScale: "40"
spec:
serviceAccountName: knative-pull-images
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nodegroup
operator: In
values:
- bicstl01
tolerations:
- effect: NoSchedule
key: webmethods.io/resourceType
operator: Equal
value: BicStateless
containers:
- image: "962734494488.dkr.ecr.us-west-2.amazonaws.com/bic/dev-cli-apps@sha256:14cbf639df0ad74f4e45e8063ccff3fe17c4e649c266fc3902114dff0e246d2c"
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /live
port: #8080
failureThreshold: 3
initialDelaySeconds: 10
# # Allow sufficient amount of time (90 seconds = periodSeconds * failureThreshold)
# # for the registered shutdown handlers to run to completion.
periodSeconds: 5
successThreshold: 1
# # Setting a very low timeout value (e.g. 1 second) can cause false-positive
# # checks and service interruption.
timeoutSeconds: 20
readinessProbe:
httpGet:
path: /health
port: #8080
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 25
volumeMounts:
- name: cli-app-startup-file
mountPath: /opt/app/server.js
subPath: server.js
env:
- name: SERVER_TIMEOUT
value: "10"
- name: REQUEST_TIMEOUT
value: "5"
volumes:
- name: cli-app-startup-file
configMap:
name: build-cli-apps
Example - 2
---
# Source: deploy-cli-apps/templates/service.yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: cli-ec93b3bb-d070-46b1-b475-b026ebfe354f-1
namespace: knative-apps-deploy
labels:
serving.knative.dev/visibility: cluster-local
appid: ec93b3bb-d070-46b1-b475-b026ebfe354f
buildid: bl-0c7fe0f1-4850-450e-a8b4-995aed91b3ab
spec:
template:
#metadata:
# annotations:
# autoscaling.knative.dev/minScale: "0"
# autoscaling.knative.dev/maxScale: "40"
spec:
serviceAccountName: knative-pull-images
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nodegroup
operator: In
values:
- bicstl01
tolerations:
- effect: NoSchedule
key: webmethods.io/resourceType
operator: Equal
value: BicStateless
containers:
- image: "725010628886.dkr.ecr.us-west-2.amazonaws.com/bic/cli-apps@sha256:e74a18eaac4fd4e2c845ac7861e5a8a72e04577a5907dbe0530df11b853e6449"
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /live
port: #8080
failureThreshold: 3
initialDelaySeconds: 10
# # Allow sufficient amount of time (90 seconds = periodSeconds * failureThreshold)
# # for the registered shutdown handlers to run to completion.
periodSeconds: 5
successThreshold: 1
# # Setting a very low timeout value (e.g. 1 second) can cause false-positive
# # checks and service interruption.
timeoutSeconds: 20
readinessProbe:
httpGet:
path: /health
port: #8080
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 25
volumeMounts:
- name: cli-app-startup-file
mountPath: /opt/app/server.js
subPath: server.js
env:
- name: CLI_EXECUTION_TIMEOUT
value: "15"
volumes:
- name: cli-app-startup-file
configMap:
name: build-cli-apps
Subscribe
Notify of
guest


0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x