$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
Docker & Kubernetesintermediate

K8s Service

Share

Create Kubernetes service and ingress configs

Works with OpenClaude

You are a Kubernetes infrastructure engineer. The user wants to create production-ready Kubernetes Service and Ingress configurations with proper networking, load balancing, and external access patterns.

What to check first

  • Run kubectl api-resources | grep -E "Service|Ingress" to verify API availability in your cluster
  • Confirm your ingress controller is installed: kubectl get ingressclass or kubectl get ingress -A
  • Check your cluster's Kubernetes version: kubectl version --short (Ingress networking.k8s.io/v1 requires 1.19+)

Steps

  1. Define a ClusterIP Service for internal pod-to-pod communication using spec.type: ClusterIP and spec.selector matching your deployment labels
  2. Add port mappings with spec.ports[].port (service port), spec.ports[].targetPort (pod port), and optional spec.ports[].name for multi-port services
  3. Create a NodePort Service with spec.type: NodePort and spec.ports[].nodePort (30000-32767 range) if you need host-level access without a load balancer
  4. Configure a LoadBalancer Service with spec.type: LoadBalancer for cloud providers (AWS/GCP/Azure) to auto-provision external IPs
  5. Create an Ingress resource with spec.ingressClassName pointing to your ingress controller (nginx, traefik, etc.)
  6. Define routing rules in spec.rules[].host and spec.rules[].http.paths[] with backend service references
  7. Add TLS termination with spec.tls[].secretName and certificate Secret resources if using HTTPS
  8. Apply configurations with kubectl apply -f service.yaml and verify with kubectl get svc,ingress -n your-namespace

Code

---
# Internal Service for pod-to-pod communication
apiVersion: v1
kind: Service
metadata:
  name: app-service
  namespace: default
  labels:
    app: myapp
spec:
  type: ClusterIP
  selector:
    app: myapp
  ports:
  - name: http
    port: 80
    targetPort: 8080
    protocol: TCP
  - name: metrics
    port: 9090
    targetPort: 9090
    protocol: TCP
  sessionAffinity: None

---
# LoadBalancer Service for external access (cloud providers)
apiVersion: v1
kind: Service
metadata:
  name: app-loadbalancer
  namespace: default
spec:
  type: LoadBalancer
  selector:
    app: myapp
  ports:
  - port: 80
    targetPort: 8080
    protocol: TCP
  externalTrafficPolicy: Local

---
# Ingress for HTTP/HTTPS routing with hostname-based routing
apiVersion: networking.k8s.io/v1
kind: Ingress

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
kubernetesserviceingress

Install command:

curl -o ~/.claude/skills/k8s-service.md https://claude-skills-hub.vercel.app/skills/docker/k8s-service.md

Related Docker & Kubernetes Skills

Other Claude Code skills in the same category — free to download.

Want a Docker & Kubernetes skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.