Kubernetes test environment Kubernetes test environment kubernetes kubernetes

Kubernetes test environment


Answering the part of whole question:

I have a hosted VPS and I would like to use this machine as a single node kubernetes test environment.

A good starting point could be to cite the parts of my own answer from Serverfault:

There are a lot of options to choose from. Each solution will have it's advantages and disadvantages. It will also depend on the operating system your VM is deployed with.

Some of the options are the following:

Each of the solutions linked above have a link to it's respective homepage. You can find there installation steps/tips. Each solution is different and I encourage you to check if selected option suits your needs.

You'll need to review the networking part of each of above solutions as some of them will have easier/more difficult process to expose your workload outside of the environment (make it accessible from the Internet).

It all boils down to what are your requirements/expectations and what are the requirements for each of the solutions.


MicroK8S setup:

I do agree with an answer provided by community member @Sekru but I also think it could be beneficiary to add an example for such setup. Assuming that you have a microk8s compatible OS:

  • sudo snap install microk8s --classic
  • sudo microk8s enable ingress
  • sudo microk8s kubectl create deployment nginx --image=nginx
  • sudo microk8s kubectl expose deployment nginx --port=80 --type=NodePort
  • sudo microk8s kubectl apply -f ingress.yaml where ingress.yaml is a file with following content:
apiVersion: networking.k8s.io/v1kind: Ingressmetadata:  name: minimal-ingressspec:  ingressClassName: public # <-- IMPORTANT  rules:  - http:      paths:      - path: /        pathType: Prefix        backend:          service:            name: nginx            port:              number: 80

After above steps you should be able to contact your Deployment from the place outside of your host by:

  • curl http://IP-ADDRESS

Side notes!

  • A setup like that will allow expose your workload on a NodePort (allocated port on each node from 30000 to 32767).
  • From the security perspective I would consider using your VPS provider firewalls to limit the traffic coming to your instance to allow only subnets that you are connecting from.

From the perspective of Gitlab integration with Kubernetes, I'd reckon you could find useful information by following it's page:

Additional resources about Kubernetes:


Yes, use microk8s. For access from outside, use ingress addon