/hello-kubernetes

Provides a demo app to deploy to a Kubernetes cluster. It displays a message, the name of the pod and details of the node it's deployed to.

Primary LanguageDockerfileMIT LicenseMIT

Hello Kubernetes!

Docker Image Version (latest by date) Docker Image Size (latest by date) Docker Pulls

This container image can be deployed on a Kubernetes cluster. It runs a web app, that displays the following:

  • a default Hello world! message
  • namespace, pod, and node details
  • container image details

Hello world! from the hello-kubernetes image

Quick start

You can deploy hello-kubernetes to your Kubernetes cluster using Helm 3. The Helm chart installation and configuration options can be found in the Deploy using Helm guide.

When running through the following examples, ensure that you are in the chart directory in the repo, since you are referencing a local helm chart.

cd deploy/helm

Example 1: Default

Deploy the hello-kubernetes app into the hello-kubernetes namespace with the default "Hello world!" message. The app is exposed via a public Load Balancer on port 80 by default - note that a LoadBalancer service typically only works in cloud provider based Kubernetes offerings.

helm install --create-namespace --namespace hello-kubernetes hello-world ./hello-kubernetes

# get the LoadBalancer ip address.
kubectl get svc hello-kubernetes-hello-world -n hello-kubernetes -o 'jsonpath={ .status.loadBalancer.ingress[0].ip }'

Example 2: Custom message

Deploy the hello-kubernetes app into the hello-kubernetes namespace with an "I just deployed this on Kubernetes!" message. The app is exposed via a public Load Balancer on port 80 by default - note that a LoadBalancer service typically only works in cloud provider based Kubernetes offerings.

helm install --create-namespace --namespace hello-kubernetes custom-message ./hello-kubernetes \
  --set message="I just deployed this on Kubernetes!"

# get the LoadBalancer ip address.
kubectl get svc hello-kubernetes-custom-message -n hello-kubernetes -o 'jsonpath={ .status.loadBalancer.ingress[0].ip }'

Example 3: Ingress

Deploy the hello-kubernetes app into the hello-kubernetes namespace. This example assumes that an ingress has been deployed and configured in the cluster, and that the ingress has a path of /app/hello-kubernetes/ mapped to the hello-kubernetes service.

The hello-kubernetes app can be reached on the ip address of the ingress via the /app/hello-kubernetes/ path.

helm install --create-namespace --namespace hello-kubernetes ingress ./hello-kubernetes \
  --set ingress.configured=true \
  --set ingress.pathPrefix="/app/hello-kubernetes/" \
  --set service.type="ClusterIP"

Documentation

Deploying

If you'd like to explore the various Helm chart configuration options, then read the Deploy with Helm documentation. You can also discover more about the ingress configuration options in the Deploy with ingress documentation

Building your own images

If you'd like to build the hello-kubernetes container image yourself and reference from your own registry or DockerHub repository, then you can get more details on how to do this in the Build and push container images documentation.

Development environment

If you have VS Code and the VS Code Remote Containers extension installed, the .devcontainer folder will be used to provide a container based development environment. You can read more about how to use this in the Development environments documentation.