<p>I have a hosted VPS and I would like to use this machine as a single node Kubernetes test environment. Is it possible to create a single-node Kubernetes cluster on the VPS, deploy pods to it using, for example, GitLab and test the application from outside the machine? I would like to locally develop, push to git and then deploy on this testing/staging environment.</p>
<p>Thank you</p>

Green
<p>Answering the part of whole question:</p>
<blockquote>
<p>I have a hosted VPS and I would like to use this machine as a single node kubernetes test environment.</p>
</blockquote>
<p>A good starting point could be to cite the parts of my own answer from <a href="https://serverfault.com/questions/1046581/is-it-possible-to-install-kubernetes-manually-in-my-existing-gcp-vm-instance/1047006#1047006">Serverfault</a>:</p>
<blockquote>
<p>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.</p>
<p><strong>Some</strong> of the options are the following:</p>
<ul>
<li><a href="https://microk8s.io/" rel="nofollow noreferrer">MicroK8S</a> - as pointed by user @Sekru</li>
<li><a href="https://minikube.sigs.k8s.io/docs/start/" rel="nofollow noreferrer">Minikube</a></li>
<li><a href="https://kind.sigs.k8s.io/docs/user/quick-start/" rel="nofollow noreferrer">Kind</a></li>
<li><a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/" rel="nofollow noreferrer">Kubeadm</a></li>
<li><a href="https://github.com/kubernetes-sigs/kubespray" rel="nofollow noreferrer">Kubespray</a></li>
<li><a href="https://github.com/kelseyhightower/kubernetes-the-hard-way" rel="nofollow noreferrer">Kelsey Hightower: Kubernetes the hard way</a></li>
</ul>
<p>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.</p>
</blockquote>
<p>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).</p>
<p>It all boils down to what are your requirements/expectations and what are the requirements for each of the solutions.</p>
<hr />
<h3>MicroK8S setup:</h3>
<p>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 <code>microk8s</code> compatible OS:</p>
<ul>
<li><code>sudo snap install microk8s --classic</code></li>
<li><code>sudo microk8s enable ingress</code></li>
<li><code>sudo microk8s kubectl create deployment nginx --image=nginx</code></li>
<li><code>sudo microk8s kubectl expose deployment nginx --port=80 --type=NodePort</code></li>
<li><code>sudo microk8s kubectl apply -f ingress.yaml</code> where <code>ingress.yaml</code> is a file with following content:</li>
</ul>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
spec:
  ingressClassName: public # &lt;-- IMPORTANT
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: nginx
            port:
              number: 80
</code></pre>
<p>After above steps you should be able to contact your <code>Deployment</code> from the place outside of your host by:</p>
<ul>
<li><code>curl http://IP-ADDRESS</code></li>
</ul>
<blockquote>
<p>Side notes!</p>
<ul>
<li>A setup like that will allow expose your workload on a <code>NodePort</code> (allocated port on each node from <code>30000</code> to <code>32767</code>).</li>
<li>From the security perspective I would consider using your <code>VPS</code> provider firewalls to limit the traffic coming to your instance to allow only subnets that you are connecting from.</li>
</ul>
</blockquote>
<hr />
<p>From the perspective of Gitlab integration with Kubernetes, I'd reckon you could find useful information by following it's page:</p>
<ul>
<li><em><a href="https://about.gitlab.com/" rel="nofollow noreferrer">About.gitlab.com</a></em></li>
</ul>
<p>Additional resources about Kubernetes:</p>
<ul>
<li><em><a href="https://kubernetes.io/docs/home/" rel="nofollow noreferrer">Kubernetes.io: Docs: Home</a></em></li>
</ul>
