Kubernetes local testing setup

8/7/2017

I've found that it is hard to use minikube to run local tests that depend on certain containers to be running. For instance using a remote headless-chrome to run some tests:

  containers:
  - image: chrome-test
    imagePullPolicy: Never
    ports:
    - containerPort: 80

  - image: headless-chrome
    imagePullPolicy: Never
    ports: 
    - containerPort: 8910
    securityContext:
      capabilities:
        add:
        - SYS_ADMIN

I've found it easier to use docker-compose for instances like these. That way I don't have to deal with deleting pods, and finding log outputs. I understand this is a pretty open ended question, but I figure any information in this area could be helpful. What is the best way to test multiple containers with kubernetes?

-- Colton Morris
google-chrome
kubernetes

1 Answer

8/16/2017

You can use docker-compose, but using minikube is also very easy to test things.

So for my testing I do following steps:

  • Create new Kubernetes Namespace
  • Deploy artifacts(here you deploy the deployment)
  • Expose that deployment with a service of type NodePort
  • Now all you need is to find out what random port was chosen as nodePort and curl on that port with minikube ip:nodePort
  • If you want logs of the pod you can get that as well
  • Once you see all the things you wanna see, just delete the Namespace.

I have done similar things while doing end to end testing of the tool called kedge which generates Kubernetes artifacts, so we deploy all generated artifacts on a running cluster in similar way I have mentioned above, ref: here.

-- surajd
Source: StackOverflow