guerai
September 15, 2021, 9:55am
1
Dear all,
I’m new in Kubernetes, there is a possibility to read deployment or service parameters from file or environment or ConfigMap?
As example
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-yaml
labels:
app.kubernetes.io/name: nginx-yaml-service
app.kubernetes.io/instance: nginx-yaml-service-06092021
environment: aks-test
spec:
replicas: $ReplicasNumber
selector:
matchLabels:
app: nginx-yaml
minReadySeconds: $minReadySeconds or configMap.minreadySec
strategy:
rollingUpdate:
maxSurge: $maxSurge or configMap.maxSurge
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: nginx-yaml
…
thanks
I can’t say that I’ve seen anything around that enables that kind of functionality. What are you trying to achieve, generic templating/modification or something else? If the former you’d want to look at things like helm, kustomize or kpt.
guerai
October 29, 2021, 8:22am
3
Thanks for your response,
I’m trying to made a solution like:
ports:
- name: liveness-port
containerPort: 8080
hostPort: 8080
livenessProbe:
httpGet:
path: /healthz
port: liveness-port
failureThreshold: 1
periodSeconds: 10
startupProbe:
httpGet:
path: /healthz
port: liveness-port
failureThreshold: 30
periodSeconds: 10
in this case liveness-port is “as a parameter/variable”. It is possible to define as example also “path” as parameter?
paths:
- name: hc-path
path: /healthz
ports:
- name: liveness-port
containerPort: 8080
hostPort: 8080
livenessProbe:
httpGet:
path: hc-path
port: liveness-port
failureThreshold: 1
periodSeconds: 10
startupProbe:
httpGet:
path: hc-path
port: liveness-port
failureThreshold: 30
periodSeconds: 10
Thanks for your time
I think the closest you’ll be able to get to that functionality is using https://kustomize.io/ and it’s patches/overlays feature .