### Install Krakend Helm Chart Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Basic installation commands for the Krakend Helm chart, including adding the repository and installing with defaults or a custom values file. ```bash helm repo add equinixmetal https://helm.equinixmetal.com helm repo update # Install with defaults (configMap mode, KrakEnd 2.7.2) helm install krakend equinixmetal/krakend # Install into a specific namespace with a custom values file helm install krakend equinixmetal/krakend \ --namespace api-gateway \ --create-namespace \ -f my-values.yaml ``` -------------------------------- ### Install Krakend Helm Chart Source: https://github.com/equinixmetal-helm/krakend/blob/main/README.md Install the Krakend Helm chart using default values. ```bash helm install krakend equinixmetal/krakend ``` -------------------------------- ### Install Krakend with All-in-One Image Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Command to install the Krakend Helm chart using a custom all-in-one image, referencing a values file that specifies `allInOneImage: true`. ```bash helm install krakend equinixmetal/krakend -f values-all-in-one.yaml ``` -------------------------------- ### Configure Krakend.io Enterprise in values.yaml Source: https://github.com/equinixmetal-helm/krakend/blob/main/README.md Example values file to configure the Helm chart for Krakend.io Enterprise. Ensure the license secret and mount path are correctly set. ```yaml image: registry: docker.io repository: krakend/krakend-ee tag: "2.1.2" extraVolumeMounts: - name: license mountPath: /etc/krakend/LICENSE readOnly: true extraVolumes: - name: license secret: secretName: krakend-license ``` -------------------------------- ### Update Documentation with helm-docs Source: https://github.com/equinixmetal-helm/krakend/blob/main/README.md Run this command to ensure the documentation is up-to-date before pushing changes. Requires helm-docs to be installed. ```bash helm-docs ``` -------------------------------- ### Kubectl Command for Creating Secret Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Example command to create a Kubernetes secret referenced for environment variables. ```bash # Create the referenced secret kubectl create secret generic krakend-env-secret \ --from-literal=API_KEY=supersecret \ --from-literal=DB_PASSWORD=dbpass ``` -------------------------------- ### Configure Krakend Lifecycle Hooks Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Set up preStop hooks for graceful shutdown of the Krakend container. This example adds a 5-second delay before the container stops. ```yaml lifecycle: preStop: exec: command: ["/bin/sh", "-c", "sleep 5"] ``` -------------------------------- ### Dockerfile for All-in-One Krakend Image Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Example Dockerfile to build a custom Krakend image with configuration baked in. Ensure the configuration files are copied to the correct paths within the image. ```dockerfile # Dockerfile for all-in-one image FROM devopsfaith/krakend:2.7.2 COPY krakend.tmpl /etc/krakend-src/config/krakend.tmpl COPY partials/ /etc/krakend-src/partials/ COPY settings/ /etc/krakend-src/settings/ ``` -------------------------------- ### Add Krakend Chart as Dependency Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Example of how to include the Krakend Helm chart as a dependency in your application's Chart.yaml file. ```yaml # Chart.yaml dependencies: - name: krakend version: "0.1.35" repository: "https://helm.equinixmetal.com" ``` -------------------------------- ### Get Application URL with LoadBalancer Service Source: https://github.com/equinixmetal-helm/krakend/blob/main/templates/NOTES.txt For LoadBalancer services, this snippet fetches the external IP assigned to the load balancer. Note that it may take a few minutes for the IP to become available. Monitor the service status with `kubectl get svc -w`. ```bash NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "krakend.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "krakend.fullname" . }} --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}") echo http://$SERVICE_IP:{{ .Values.service.port }} ``` -------------------------------- ### Get Application URL with Ingress Enabled Source: https://github.com/equinixmetal-helm/krakend/blob/main/templates/NOTES.txt When ingress is enabled, this template generates the application URL based on configured hosts and paths. Ensure your ingress controller is properly set up. ```go-template {{- if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} {{- range .paths }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} {{- end }} ``` -------------------------------- ### Get Application URL with NodePort Service Source: https://github.com/equinixmetal-helm/krakend/blob/main/templates/NOTES.txt If the service type is NodePort, these commands retrieve the NodePort and Node IP to construct the application URL. This is useful for direct access to the service. ```bash export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "krakend.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT ``` -------------------------------- ### Extra Volumes and Init Containers for Plugins Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Configures extra volumes for licenses or plugins and uses init containers to download plugins at startup. ```yaml extraVolumes: - name: license secret: secretName: krakend-license - name: plugins emptyDir: {} extraVolumeMounts: - name: license mountPath: /etc/krakend/LICENSE readOnly: true - name: plugins mountPath: /usr/lib/krakend/plugins initContainers: - name: load-plugin image: "appropriate/curl:latest" imagePullPolicy: IfNotPresent volumeMounts: - name: plugins mountPath: /usr/lib/krakend/plugins command: - "/bin/sh" - "-c" - | curl -L https://github.com/my-org/krakend-plugin/releases/download/v1.0.0/plugin.so \ -o /usr/lib/krakend/plugins/plugin.so ``` -------------------------------- ### Add Krakend Helm Repository Source: https://github.com/equinixmetal-helm/krakend/blob/main/README.md Add the Equinix Metal helm repository to your Helm configuration. ```bash helm repo add equinixmetal https://helm.equinixmetal.com ``` -------------------------------- ### Configure Krakend Enterprise Image and License Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Switch to the Krakend Enterprise Edition by specifying the EE image and mounting a license secret. Ensure the license secret is created beforehand. ```yaml image: registry: docker.io repository: krakend/krakend-ee tag: "2.7.2" extraVolumes: - name: license secret: secretName: krakend-license extraVolumeMounts: - name: license mountPath: /etc/krakend/LICENSE readOnly: true ``` ```bash # Create the license secret from a file kubectl create secret generic krakend-license \ --from-file=LICENSE=/path/to/krakend.license ``` -------------------------------- ### All-in-One Image Mode Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Configuration for the all-in-one image mode in values.yaml, setting `allInOneImage` to true and specifying the custom image details. ```yaml # values.yaml – all-in-one image mode image: registry: docker.io repository: my-org/krakend-custom tag: "v1.2.3" pullPolicy: IfNotPresent krakend: allInOneImage: true ``` -------------------------------- ### KEDA ScaledObject Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Sets up a KEDA ScaledObject for event-driven autoscaling based on metrics like Prometheus. Mutually exclusive with HPA. ```yaml keda: enabled: true minReplicas: 1 maxReplicas: 20 pollingInterval: 30 cooldownPeriod: 300 restoreToOriginalReplicaCount: true scaledObject: annotations: autoscaling.keda.sh/paused-replicas: "0" triggers: - type: prometheus metadata: serverAddress: http://prometheus.monitoring:9090 metricName: krakend_requests_total threshold: "100" query: sum(rate(krakend_requests_total[2m])) behavior: scaleDown: stabilizationWindowSeconds: 300 policies: - type: Pods value: 1 periodSeconds: 180 ``` -------------------------------- ### Access Application with ClusterIP Service via Port-Forwarding Source: https://github.com/equinixmetal-helm/krakend/blob/main/templates/NOTES.txt When using a ClusterIP service, this command sets up port-forwarding to access the application locally. It retrieves the pod name and container port, then forwards traffic to `127.0.0.1:8080`. ```bash export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "krakend.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT ``` -------------------------------- ### Cut a Release with Makefile Source: https://github.com/equinixmetal-helm/krakend/blob/main/README.md Use this Makefile target to cut a release. Set the TAG variable to the desired release version (e.g., '1.2.3' for v1.2.3). ```bash TAG=$RELEASE_VERSION make release ``` ```bash TAG=1.2.3 make release ``` -------------------------------- ### Default Security Context for Krakend Pods Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Configure pod and container security contexts to harden Krakend deployments. Ensures non-root execution and read-only root filesystem by default. ```yaml podSecurityContext: fsGroup: 2000 securityContext: allowPrivilegeEscalation: false runAsNonRoot: true runAsUser: 1000 readOnlyRootFilesystem: true capabilities: drop: - ALL add: - NET_BIND_SERVICE ``` -------------------------------- ### Configure Topology Spread and Affinity for Krakend Pods Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Ensure high availability by spreading Krakend pods across zones and nodes using topology spread constraints and pod anti-affinity rules. ```yaml topologySpreadConstraints: - maxSkew: 1 topologyKey: topology.kubernetes.io/zone whenUnsatisfiable: DoNotSchedule labelSelector: matchLabels: app.kubernetes.io/name: krakend affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app.kubernetes.io/name operator: In values: - krakend topologyKey: kubernetes.io/hostname ``` -------------------------------- ### Prometheus ServiceMonitor Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Creates a ServiceMonitor resource for Prometheus Operator to scrape Krakend metrics. ```yaml serviceMonitor: enabled: true annotations: prometheus.io/scrape: "true" interval: 15s scrapeTimeout: 10s targetPort: 9091 ``` -------------------------------- ### Kubernetes Ingress Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Enables and configures a Kubernetes Ingress resource for exposing Krakend. Supports multiple Kubernetes API versions. ```yaml ingress: enabled: true className: "nginx" annotations: nginx.ingress.kubernetes.io/rewrite-target: / cert-manager.io/cluster-issuer: letsencrypt-prod hosts: - host: api.example.com paths: - path: / pathType: Prefix tls: - secretName: api-example-tls hosts: - api.example.com ``` -------------------------------- ### Reference Krakend Chart as Dependency Source: https://github.com/equinixmetal-helm/krakend/blob/main/README.md Reference the Krakend chart in your chart's dependencies section. ```yaml dependencies: - name: krakend version: v0.1.16 repository: "https://helm.equinixmetal.com" ``` -------------------------------- ### PodDisruptionBudget Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Configures a PodDisruptionBudget to ensure minimum availability of Krakend pods during voluntary disruptions. ```yaml podDisruptionBudget: enabled: true minAvailable: 1 maxUnavailable: "" unhealthyPodEvictionPolicy: "AlwaysAllow" ``` -------------------------------- ### ConfigMap-Based Mode Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Configuration options for the default ConfigMap-based mode in values.yaml, including disabling all-in-one image, specifying config file source, and defining partials and settings. ```yaml # values.yaml – configMap mode (default) krakend: allInOneImage: false # default # Full override of the main krakend.tmpl (optional) config: "" # leave empty to use the generated template # Or point to a file in the chart directory (flexible-config generated) configFileSource: "config/krakend.tmpl" # Partials mounted at /etc/krakend-src/partials/ partials: input_headers.tmpl: |- "input_headers": [ "Content-Type", "Authorization" ] rate_limit_backend.tmpl: |- "qos/ratelimit/proxy": { "max_rate": 10, "capacity": 10 } endpoints.tmpl: |- [ { "endpoint": "/api/v1/users", "method": "GET", "backend": [ { "method": "GET", "host": ["http://user-service:8080"], "url_pattern": "/users", "encoding": "json" } ], "output_encoding": "json" } ] # Settings mounted at /etc/krakend-src/settings/ settings: service.json: |- { "environment": "PRODUCTION", "default_host": "http://backend-service:8080", "timeout": "3s", "cache_ttl": "3s", "output_encoding": "json" } # Service-level extra_config (router, telemetry, etc.) extraConfig: router: "@comment": "Health endpoint excluded from logs" logger_skip_paths: - "/__health" ``` -------------------------------- ### Argo Rollouts Deployment Strategy Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Switches the deployment type to Argo Rollouts for advanced progressive delivery. Requires `deploymentType: rollout`. ```yaml deploymentType: rollout strategy: canary: steps: - setWeight: 20 - pause: { duration: 1m } - setWeight: 50 - pause: { duration: 2m } - setWeight: 100 ``` -------------------------------- ### Kubernetes Service Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Configuration for the Kubernetes Service that exposes the Krakend gateway. Allows setting the service type, ports, and annotations, including enabling a separate metrics port. ```yaml service: type: ClusterIP # ClusterIP | NodePort | LoadBalancer port: 80 targetPort: 8080 externalTrafficPolicy: "" annotations: external-dns.alpha.kubernetes.io/hostname: krakend.example.com metrics: enabled: true port: 9100 targetPort: 9100 ``` -------------------------------- ### Environment Variables and Secrets Management Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Injects environment variables directly or references a Kubernetes Secret for sensitive configuration values. ```yaml krakend: env: - name: SERVICE_NAME value: "my-api-gateway" - name: BACKEND_HOST valueFrom: configMapKeyRef: name: app-config key: backend_host envFromSecret: "krakend-env-secret" ``` -------------------------------- ### Horizontal Pod Autoscaler (HPA) Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Configures Kubernetes Horizontal Pod Autoscaler for CPU and memory utilization. Mutually exclusive with KEDA. ```yaml autoscaling: enabled: true minReplicas: 2 maxReplicas: 10 targetCPUUtilizationPercentage: 70 targetMemoryUtilizationPercentage: 80 annotations: custom-annotation: "value" behavior: scaleDown: stabilizationWindowSeconds: 300 policies: - type: Pods value: 1 periodSeconds: 180 scaleUp: stabilizationWindowSeconds: 60 policies: - type: Pods value: 2 periodSeconds: 60 ``` -------------------------------- ### Kubernetes NetworkPolicy Configuration Source: https://context7.com/equinixmetal-helm/krakend/llms.txt Defines Kubernetes NetworkPolicies to control ingress and egress traffic for Krakend pods. ```yaml networkPolicies: enabled: true policies: - name: allow-frontend-namespace namespace: frontend type: ingress - name: allow-backend-namespace namespace: backend type: egress ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.