'How does Gitlab runner with Kubernetes executor create pods when it is a pod itself?

Hey I'm new to CI/CD with gitlab and I am a bit confused.

I got a Kubernetes cluster connected to a Gitlab instance to run CI/CD pipelines. There is a gitlab runner with kubernetes executor, from what I understand it means there is a pod which runs the pipelines.

A look with kubectl get pods -n gitlab-runner supports that (now there is some other issue, but normally it is 1/1 running):

NAMESPACE        NAME                                           READY   STATUS    RESTARTS   AGE
gitlab-runner    gitlab-runner-gitlab-runner-6b7bf4d766-9t4k6   0/1     Running   248        29d

The CI/CD pipelines calls commands like kubectl apply -f [...], to create new deployments and pods. But why does that work? If the pipeline commands are run the pod, modifications to the host cluster config should be impossible, right? I thought the whole point of containerization is that guests can't modify the host.

Where is the flaw in my logic?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source