Claude Skills Guide

Claude Code for NGINX Ingress Workflow Tutorial

NGINX Ingress Controller is the go-to solution for managing external access to Kubernetes services. Yet configuring ingress resources, managing SSL certificates, and handling routing rules can become tedious and error-prone. This tutorial shows you how to use Claude Code to automate and accelerate your NGINX Ingress workflow from configuration to deployment.

Prerequisites

Before diving in, ensure you have the following in place:

Setting Up Your Project

Create a dedicated directory for your ingress configurations. This keeps things organized and gives Claude Code context about your setup.

mkdir nginx-ingress-workspace && cd nginx-ingress-workspace

Initialize a simple structure:

mkdir -p ingress manifests certs

Now invoke Claude Code to analyze your cluster’s current ingress state:

claude "List all existing ingress resources in the default namespace and summarize their configurations"

Claude Code will query your cluster and present a clear summary of current routing rules, which helps identify gaps or misconfigurations.

Creating Ingress Resources with Claude Code

Writing ingress YAML by hand is prone to typos and omissions. Let Claude Code generate them based on your requirements.

Basic Ingress Configuration

Ask Claude Code to create an ingress resource:

claude "Create an ingress resource for my api-service in the default namespace. The service runs on port 8080, should use TLS, and route /api traffic to the backend"

Claude Code generates something like:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-ingress
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/proxy-body-size: "50m"
spec:
  ingressClassName: nginx
  tls:
  - hosts:
    - api.example.com
    secretName: api-tls-secret
  rules:
  - host: api.example.com
    http:
      paths:
      - path: /api
        pathType: Prefix
        backend:
          service:
            name: api-service
            port:
              number: 8080

Review the output, modify as needed, and apply:

kubectl apply -f ingress/api-ingress.yaml

Advanced Routing Patterns

For complex routing, describe your requirements to Claude Code:

claude "Create an ingress with path-based routing: /webapp goes to web-service:80, /api goes to api-service:8080, /admin goes to admin-service:3000. Include rate limiting and IP restriction for /admin"

Claude Code produces a complete configuration:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: multi-service-ingress
  annotations:
    nginx.ingress.kubernetes.io/limit-rps: "100"
    nginx.ingress.kubernetes.io/limit-connections: "50"
    nginx.ingress.kubernetes.io/whitelist-source-range: "10.0.0.0/8,192.168.1.0/24"
spec:
  ingressClassName: nginx
  rules:
  - host: app.example.com
    http:
      paths:
      - path: /webapp
        pathType: Prefix
        backend:
          service:
            name: web-service
            port:
              number: 80
      - path: /api
        pathType: Prefix
        backend:
          service:
            name: api-service
            port:
              number: 8080
      - path: /admin
        pathType: PathType
        backend:
          service:
            name: admin-service
            port:
              number: 3000

Managing SSL/TLS Certificates

Secure your services with TLS. Claude Code can help generate self-signed certificates for development or configure cert-manager integration.

Generating Self-Signed Certificates

claude "Generate a self-signed TLS certificate for host api.example.com and save the certificate and key to certs/ directory"

Claude Code executes:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
  -keyout certs/api-tls.key \
  -out certs/api-tls.crt \
  -subj "/CN=api.example.com" \
  -addext "subjectAltName=DNS:api.example.com"

Create the Kubernetes secret:

kubectl create secret tls api-tls-secret \
  --cert=certs/api-tls.crt \
  --key=certs/api-tls.key

Setting Up Cert-Manager Integration

For production, use cert-manager with Let’s Encrypt. Ask Claude Code:

claude "Add the necessary annotations to enable Let's Encrypt TLS for an ingress resource with host api.example.com, using HTTP01 challenge"

The response provides the annotated configuration:

metadata:
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    cert-manager.io/acme-challenge-type: "http01"
spec:
  tls:
  - hosts:
    - api.example.com
    secretName: api-letsencrypt-secret

Troubleshooting Common Issues

Claude Code excels at diagnosing ingress problems. When traffic isn’t routing correctly, ask:

claude "Debug why requests to api.example.com/api are returning 404. Check the ingress controller logs and describe the likely causes"

Claude Code analyzes logs and common misconfigurations, explaining:

Checking Ingress Controller Status

claude "Get the status of the NGINX Ingress controller pods and report their health and recent events"

Automating Deployments

Create scripts that combine multiple steps. Ask Claude Code:

claude "Create a bash script that deploys an ingress resource from ingress/*.yaml, applies any new TLS secrets, and verifies the ingress status"

Claude Code generates:

#!/bin/bash
set -e

echo "Applying ingress resources..."
kubectl apply -f ingress/

echo "Applying TLS secrets..."
for cert in certs/*.crt; do
  name=$(basename "$cert" .crt)
  kubectl create secret tls "${name}-tls" \
    --cert="$cert" \
    --key="certs/${name}.key" \
    --dry-run=client -o yaml | kubectl apply -f -
done

echo "Checking ingress status..."
kubectl get ingress

echo "Verifying endpoints..."
kubectl get endpoints

Make it executable and use it:

chmod +x deploy-ingress.sh
./deploy-ingress.sh

Best Practices

Follow these recommendations when working with NGINX Ingress and Claude Code:

  1. Use ingressClassName explicitly – Avoid relying on the default class
  2. Define TLS minimum versions – Add ssl-prefer-server-ciphers: "true" and specify ssl-min-version: "TLSv1.2"
  3. Set appropriate timeouts – Configure proxy-connect-timeout, proxy-send-timeout, and proxy-read-timeout for long-running requests
  4. Enable access logging – Use annotations like nginx.ingress.kubernetes.io/log-format-upstream for detailed debugging
  5. Version your configurations – Keep ingress YAML in version control

Conclusion

Claude Code transforms NGINX Ingress management from manual YAML editing to an interactive, intelligent workflow. By describing your requirements in natural language, you generate accurate configurations faster while reducing errors. The key is providing clear context—cluster state, service details, and routing requirements—and iterating on Claude Code’s suggestions.

Start small: generate your first ingress resource, apply it, then expand to more complex scenarios like multi-path routing, SSL management, and automated deployments. As you grow comfortable with the workflow, you’ll find Claude Code invaluable for troubleshooting and optimizing your ingress infrastructure.

Remember that Claude Code is a collaborator, not a replacement for understanding your infrastructure. Review generated configurations, especially security-related settings, before applying them to production environments.

Built by theluckystrike — More at zovo.one