Write Kubernetes manifests for a frontend and backend with pinned images, ConfigMaps and Secrets, readiness and liveness probes, resource settings and Services that match their pods.
Write Kubernetes manifests for the application below. Produce resources that `kubectl apply` can accept, keep secrets out of ConfigMaps, and make every Service selector match its pods. ## Inputs Services with image repository, version tag, container port and health endpoints: [SERVICES] Database: managed service endpoint or in-cluster database: [DATABASE] Configuration values (non-secret) and secret names: [CONFIGURATION] Namespace, replica counts and exposure (ClusterIP, Ingress, LoadBalancer): [DEPLOYMENT_SETTINGS] Measured or estimated CPU and memory use per container: [RESOURCE_DATA] Kubernetes version and cluster type: [CLUSTER] ## Instructions 1. One Deployment and one Service per stateless service. Labels in `spec.selector.matchLabels`, the pod template and the Service selector must match. 2. Pin images to a version tag or digest; do not use `latest`. 3. Put non-secret settings (for example `DB_HOST`, `DB_PORT`) in a ConfigMap and credentials (`DB_USERNAME`, `DB_PASSWORD`) in a Secret referenced with `secretKeyRef`. Show the Secret with placeholder values or as a command, never real values. 4. Readiness probes decide when traffic is sent; liveness probes restart stuck containers. Use different endpoints or thresholds if a dependency outage should not trigger restarts. Add a startup probe for slow starts. 5. Set resource requests and limits from [RESOURCE_DATA]; if none is supplied, mark values as starting points to adjust after observing usage. 6. Persistent storage: stateless Deployments do not mount a PersistentVolumeClaim. If the database runs in the cluster, use a StatefulSet with a volumeClaimTemplate, or recommend the managed database from [DATABASE]. 7. Set the container `securityContext` (runAsNonRoot, no privilege escalation) where the images support it. ## Return 1. Manifests as one YAML stream separated by `---`, or as named files. 2. A table mapping each Service port to its targetPort and containerPort. 3. Commands to validate (`kubectl apply --dry-run=server` against a test cluster, or a schema validator offline) and to apply. 4. Assumptions and values to adjust. ## Acceptance checks - Every selector matches its pod template labels. - Every Service targetPort equals a declared containerPort. - No credentials in ConfigMaps or in plain `env` values. - No `latest` tags. - Probes reference endpoints listed in [SERVICES].
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
Services: frontend ghcr.io/acme/web:1.8.2 (Node, port 3000, GET /healthz); backend ghcr.io/acme/api:2.4.0 (Python, port 5000, GET /ready checks DB, GET /live does not) Database: managed PostgreSQL at db.internal.example:5432 Configuration: DB_HOST, DB_PORT in ConfigMap; DB_USERNAME, DB_PASSWORD from Secret api-db Settings: namespace shop, 2 replicas each, frontend exposed via Ingress, backend ClusterIP only Resource data: none Cluster: Kubernetes 1.33 on a managed service
A YAML stream with Namespace, ConfigMap api-config, a Secret placeholder or kubectl create secret command, Deployments web and api with matching app labels, Services web (80 -> 3000) and api (5000 -> 5000), an Ingress for web only, readiness on /ready and liveness on /live for the backend, resource requests marked as starting points because no data was supplied, and no PersistentVolumeClaim because the database is managed. Illustrative expectation; a local script checked selector/label and port consistency on a reference manifest of this shape (see report).
Ask questions or share concrete improvements.
No comments yet.
Sign in to join the discussion.
Guides for adapting and checking prompts: