cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-server
spec:
selector:
matchLabels:
run: hello-server
replicas: 1
template:
metadata:
labels:
run: hello-server
spec:
containers:
- name: hello-server
image: nginx
ports:
- containerPort: 80
resources:
requests:
cpu: "0.5"
---
apiVersion: v1
kind: Service
metadata:
name: hello-server
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
selector:
run: hello-server
EOF
kubectl run -it --rm --image=gcr.io/gcp-runtimes/ubuntu_18_0_4 \
--restart=Never \
loadtest \
--command -- bash -c "apt -qq update && apt -qq install -y wget && wget -q https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 && chmod +x hey_linux_amd64 && ./hey_linux_amd64 -z 30s http://hello-server"
kubectl scale deployment/hello-server --replicas=5
kubectl delete pod/loadtest
kubectl run -it --rm --image=gcr.io/gcp-runtimes/ubuntu_18_0_4 \
--restart=Never \
loadtest \
--command -- bash -c "apt -qq update && apt -qq install -y wget && wget -q https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 && chmod +x hey_linux_amd64 && ./hey_linux_amd64 -z 30s http://hello-server"