helloworld sample service (Istio)¶
The helloworld sample service is a simple demonstration application used within the Istio ecosystem to test and experiment with traffic routing, specifically for version-based strategies like [[canary deployments]].^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]
Overview¶
The sample includes two versions of a service. When called, the service returns its specific version identifier (e.g., v1 or v2) and its instance hostname.^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md] This behavior allows developers to visually verify which version of the application is handling a request.
Deployment¶
The service is deployed via a helloworld.yaml file.^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md] The instructions assume the cluster has automatic sidecar injection enabled, which is the standard method for integrating Istio proxies into the application pods.^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]
Running the Service¶
You can run both versions simultaneously or deploy them individually using labels^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]:
- Deploy both:
kubectl apply -f helloworld.yaml - Deploy specific version:
kubectl apply -f helloworld.yaml -l version=v1
Custom Versions¶
A helper script, gen-helloworld.sh, is provided to generate customized YAML manifests.^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md] This script accepts arguments such as --version (to set the returned version string) and --includeService (to toggle the inclusion of the Service resource).^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]
Networking and Access¶
To make the service accessible externally, an Istio Gateway must be configured^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md].
- Apply Gateway:
kubectl apply -f helloworld-gateway.yaml^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md] - Verify Access: After setting the
INGRESS_HOSTandINGRESS_PORTenvironment variables, the service can be queried viacurlto confirm it is routing traffic correctly^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md].
Autoscaling Integration¶
This sample is configured to demonstrate integration with Kubernetes Horizontal Pod Autoscalers (HPA).^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]
For HPA to function correctly, all containers within the pod must specify CPU resource requests.^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md] In this sample, both the application container and the injected istio-proxy container include these requests^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md].
To verify autoscaling, you can enable HPA on the deployments and run the provided loadgen.sh script to generate traffic.^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__helloworld__README.md]