I have a server written in Go that presents a REST API. This service runs fine on MacOS, and also as a cross-compiled Linux executable in a Docker container. And for a few days, it ran fine deployed in minikube as well. Somehow it has quit working on minikube, failing with an "address has too many commas" error. I have tried various flavors of Addr specification, all with the same result -- works everywhere but minikube.
// Configure http server
srv := &http.Server{
Handler: r,
Addr: ":8087",
WriteTimeout: 15 * time.Second,
ReadTimeout: 15 * time.Second,
}
// Listen to configured port and serve
log.Fatal(srv.ListenAndServe())
My Dockerfile:
FROM alpine:latest
WORKDIR /home
COPY ./bin/afg-linux afg
EXPOSE 8087
RUN chmod +x afg
CMD ./afg
And the minikube YAML:
# APP DEPLOYMENT
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
run: afg
name: afg
spec:
replicas: 1
selector:
matchLabels:
run: afg-ex
template:
metadata:
labels:
run: afg-ex
spec:
containers:
- image: localhost:5000/afg:v1.02
name: afg
ports:
- containerPort: 8087
protocol: TCP
---
# APP SERVICE
apiVersion: v1
kind: Service
metadata:
labels:
run: afg
name: afg
spec:
ports:
- port: 8087
protocol: TCP
targetPort: 8087
selector:
run: afg-ex
type: NodePort