#randomly #startup #word #serve #load-balancing #kubernetes #string

app one-word-server

Serve a word, randomly chosen at startup

1 unstable release

0.1.0 May 6, 2023

#14 in #randomly

MIT license

7KB

Serve a string per HTTP

The string is chosen randomly at startup.

This is to test load balancing in a Kubernetes cluster.
Once a container/pod is startet, it will always return the same string.

Run

cargo run

You can now fetch the string:

curl http://localhost:8080/
# fast-duck

Kubernetes deployment

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: one-word-server
  labels:
    app: rust
spec:
  replicas: 3
  selector:
    matchLabels:
      app: rust
  template:
    metadata:
      labels:
        app: rust
    spec:
      containers:
      - name: build
        image: rust:latest
        command:
          - cargo
          - run
          - one-word-server

Dependencies

~14–24MB
~198K SLoC