Skip to content
TheChatArchiveThe Chat Archive
NVIDIAUnspecified NVIDIA model (HelpSteer2)· NVIDIANVIDIA NVIDIA HelpSteer2

how to prevent installing apps in k8s with helm without readyness liveness probes?

  1. User

    how to prevent installing apps in k8s with helm without readyness liveness probes?

  2. NVIDIA Assistant

    To prevent installing apps in Kubernetes (k8s) with Helm without readiness and liveness probes, you can follow these steps:

    1. Create a custom Helm chart template: You can create a custom Helm chart template that includes readiness and liveness probes by default. This way, whenever you install a new app using this template, the probes will be automatically included.

    Here's an example of how to include readiness and liveness probes in a Helm chart:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: {{ .Release.Name }}
    spec:
      replicas: {{ .Values.replicaCount }}
      selector:
        matchLabels:
          app: {{ .Release.Name }}
      template:
        metadata:
          labels:
            app: {{ .Release.Name }}
        spec:
          containers:
            - name: {{ .Release.Name }}
              image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
              imagePullPolicy: {{ .Values.image.pullPolicy }}
              ports:
                - name: http
                  containerPort: 80
                  protocol: TCP
              readinessProbe:
                httpGet:
                  path: /healthz
                  port: http
                initialDelaySeconds: 5
                periodSeconds: 10
              livenessProbe:
                httpGet:
                  path: /healthz
                  port: http
                initialDelaySeconds: 15
                periodSeconds: 20
    
    1. Use a policy management tool: You can use a policy management tool like Kyverno, Gatekeeper, or Open Policy Agent to enforce the use of readiness and liveness probes in your k8s cluster. These tools allow you to define policies that restrict the installation of apps without probes.

    Here's an example of a Kyverno policy that enforces the use of readiness and liveness probes:

    apiVersion: kyverno.io/v1
    kind: ClusterPolicy
    metadata:
      name: require-probes
    spec:
      rules:
        - name: require-readiness-probe
    

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.