Advanced Topics

Learn about advanced Knative features and best practices for production deployments.

Custom Domains

To use a custom domain, update the domain configuration:

Terminal window
kubectl patch configmap config-domain -n knative-serving \
--type merge \
-p '{"data":{"example.com":""}}'

Health Checks

Configure liveness and readiness probes:

spec:
template:
spec:
containers:
- image: your-image
livenessProbe:
httpGet:
path: /health
readinessProbe:
httpGet:
path: /ready

Best Practices

  1. Use meaningful revision names for easier traffic management
  2. Set appropriate resource limits to optimize costs
  3. Implement proper health checks for reliable deployments
  4. Use secrets for sensitive data instead of environment variables
  5. Monitor your services with observability tools

Troubleshooting

Service Not Ready

Check the service status:

Terminal window
kubectl describe ksvc hello

View pod logs:

Terminal window
kubectl logs -l serving.knative.dev/service=hello

DNS Issues

Verify DNS configuration:

Terminal window
kubectl get configmap config-domain -n knative-serving -o yaml

Conclusion

Knative provides a powerful platform for building and running serverless applications on Kubernetes. With its auto-scaling capabilities, revision management, and traffic splitting features, it simplifies the deployment and management of cloud-native applications.