Kubernetes Pod arguments not applied correctly to Docker image, and arguments are missing

528 views
Skip to first unread message

Henry Hottelet

unread,
Dec 7, 2017, 2:11:17 PM12/7/17
to Kubernetes user discussion and Q&A


The Kubernetes Pod should properly accept arguments as does Docker.

See Pod.yaml
https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra/blob/master/Kubernetes/singlePod.yaml

The problem is that the program accepts arguments from java command line:
java -jar ./target/spring-boot-web-0.0.1-SNAPSHOT.jar -Dcassandra_ip=127.0.0.1 -Dcassandra_port=9042

The Docker container, also accepts arguments from the Docker command line:
docker run -it -p 8080:8080 joethecoder2/spring-boot-web cassandra_ip=127.0.0.1 cassandra_port=9042

However, Kubernetes Pods are behaving inconsistently, when calling arguments from kubectl:
kubectl create -f ./singlePod.yaml
kubectl describe pod spring-boot-web

The Pod service shows:

Name: spring-boot-web-demo

Namespace: default

Node: minikube/192.168.64.3

Start Time: Thu, 07 Dec 2017 13:39:26 -0500

Labels: purpose=demonstrate-spring-boot-web

Annotations: <none>

Status: Running

IP: 172.17.0.2

Controllers: <none>

Containers:

  spring-boot-web:

    Container ID: docker://118422161e010b01ba976f34fe2787673920b95438d1537a576c416d911a2723

    Image: docker.io/joethecoder2/spring-boot-web

    Image ID: docker-pullable://joethecoder2/spring-boot-web@sha256:ebf94365075e0ee16a50cab41d8e1307785a93c60be600f94bb82a4dbefb6bc0

    Port:

    Command:

      java

      -jar

      spring-boot-web-0.0.1-SNAPSHOT.jar

      cassandra_ip=127.0.0.1

      cassandra_port=9042

    Args:

      cassandra_ip=127.0.0.1

      cassandra_port=9042

    State: Running

      Started: Thu, 07 Dec 2017 13:39:27 -0500

    Ready: True

    Restart Count: 0

    Environment:

      cassandra_ip: 127.0.0.1

      cassandra_port: 9042

    Mounts:

      /var/run/secrets/kubernetes.io/serviceaccount from default-token-wgdn6 (ro)

Conditions:

  Type Status

  Initialized True 

  Ready True 

  PodScheduled True 

Volumes:

  default-token-wgdn6:

    Type: Secret (a volume populated by a Secret)

    SecretName: default-token-wgdn6

    Optional: false

QoS Class: BestEffort

Node-Selectors: <none>

Tolerations: <none>

Events:

  FirstSeen LastSeen Count From SubObjectPath Type Reason Message

  --------- -------- ----- ---- ------------- -------- ------ -------

  1m 1m 1 default-scheduler Normal Scheduled Successfully assigned spring-boot-web-demo to minikube

  1m 1m 1 kubelet, minikube Normal SuccessfulMountVolume MountVolume.SetUp succeeded for volume "default-token-wgdn6" 

  1m 1m 1 kubelet, minikube spec.containers{spring-boot-web} Normal Pulling pulling image "docker.io/joethecoder2/spring-boot-web"

  1m 1m 1 kubelet, minikube spec.containers{spring-boot-web} Normal Pulled Successfully pulled image "docker.io/joethecoder2/spring-boot-web"

  1m 1m 1 kubelet, minikube spec.containers{spring-boot-web} Normal Created Created container

  1m 1m 1 kubelet, minikube spec.containers{spring-boot-web} Normal Started Started container



The expected results are for the service to show the arguments when the service is called:

kubectl logs spring-boot-web-demo


The error, is that the Kubernetes pod arguments are not being applied correctly, and the REST service is not returning the correct result:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' 'http://192.168.64.3:31545/restaurant/arguments'
Reply all
Reply to author
Forward
0 new messages