duanlaiquan8174 2018-05-30 18:17
浏览 28

http.Server.ListenAndServe仅在Minikube上崩溃“太多逗号”

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
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法