workloads

command module
v0.0.0-...-2dfe69b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 17 Imported by: 0

README

Interacting with Kubernetes Workloads

In this example, we'll explore how to interact with the Kubernetes API using a Go client to create a namespace, ingress, service, and deployment to run an Nginx hello world service.

The service runs locally in KinD streaming logs from the pods in the service to STDOUT. After the service is started, open a browser to http://localhost:8080/hello. You should see the request stream to STDOUT, and you should be greeted with a page describing the request and the server that served it. If you refresh the page, you should see the server name change indicating the requests are load balancing across the 2 pod replicas in the deployment.

Required tools

  • docker
  • kubectl
  • kind

Running the code

kind create cluster --name workloads --config kind-config.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
kubectl wait --namespace ingress-nginx \
  --for=condition=ready pod \
  --selector=app.kubernetes.io/component=controller \
  --timeout=90s
go run .

Deleting the KinD cluster

Deleting the KinD cluster will clean up all resources used for this example.

kind delete cluster --name workloads

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL