http-echo is a minimal http server with the purpose of just serving plain text. This can be useful when testing or learning tools like Kubernetes.
This project was highly ispired by hashicorp/http-echo
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Make a fast Deployment
kubectl apply -f https://github.com/carlosgrillet/http-echo/releases/download/v0.1.0/http-echo.yamlOr create a file and change it as you wish.
apiVersion: apps/v1
kind: Deployment
metadata:
name: http-echo
labels:
app: http-echo
spec:
replicas: 3
selector:
matchLabels:
app: http-echo
template:
metadata:
labels:
app: http-echo
spec:
containers:
- name: http-echo
image: carlosgrillet/http-echo:latest
args:
- "http-echo"
- "--text"
- "Pod: $(POD_NAME)\nNamespace: $(POD_NAMESPACE)\nIP: $(POD_IP)\nNode: $(NODE_NAME)\nCPU-R: $(CPU_REQUEST)\nMEM-R: $(MEMORY_REQUEST)\nCPU-L: $(CPU_LIMIT)\nMEM-L: $(MEMORY_LIMIT)"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: CPU_REQUEST
valueFrom:
resourceFieldRef:
resource: requests.cpu
- name: MEMORY_REQUEST
valueFrom:
resourceFieldRef:
resource: requests.memory
- name: CPU_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.cpu
- name: MEMORY_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: http-echo
spec:
selector:
app: http-echo
ports:
- protocol: TCP
port: 80
targetPort: 8080
type: ClusterIP
# type: LoadBalancer # for external accessRun build make command with tests
make allBuild the application
make buildRun the application
make runLive reload the application:
make watchRun the test suite:
make testClean up binary from the last build:
make clean