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 | |
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND