简体   繁体   中英

kubernetes service exposing shellinabox timeout after approx. 60 seconds

I have kubernetes installed on bare metal ubuntu server, below is the output of kubectl version command

Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0", GitCommit:"fff5156092b56e6bd60fff75aad4dc9de6b6ef37", GitTreeState:"clean", BuildDate:"2017-03-28T16:36:33Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.3", GitCommit:"0480917b552be33e2dba47386e51decb1a211df6", GitTreeState:"clean", BuildDate:"2017-05-10T15:38:08Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

I am running google shellinabox inside a docker container. It all works well with the docker container, but when I put the same image inside a kubernetes pod and expose it with a kubernetes service, my browser session to shellinabox times out after ~60 secs. Since this works fine with standalone docker container, I think this is caused by kubernetes. Is there any timeout on the kubernetes and how do I configure that.

Any help?

Enable the session Affinity to direct the traffic to one pod per client session here is the samepl deployment.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: shellinabox
  labels:
    k8s-app: shellinabox
    tier: frontend
  namespace: default
spec:
  replicas: 2
  template:
    metadata:
      labels:
        k8s-app: shellinabox
    spec:      
      containers:
      - name: shellinabox        
        image: sspreitzer/shellinabox:latest
        env:
        - name: SIAB_PASSWORD
          value: abc123
        - name: SIAB_SUDO
          value: 'true'        
        ports:
        - containerPort: 4200
---
apiVersion: v1
kind: Service
metadata:
  name: shellinabox-svc
  labels:
    app: shellinabox-svc
  namespace: default
spec:
  type: NodePort
  ports:
    - port: 4200
      targetPort: 4200     
  selector:
    k8s-app: shellinabox
  sessionAffinity: ClientIP  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM