> For the complete documentation index, see [llms.txt](https://campus-rover.gitbook.io/lab-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://campus-rover.gitbook.io/lab-notebook/fiiva/vnc-cluster/operation-guide/operating/cluster.md).

# cluster.md

We administrate all our operations through the use of `kubectl`.

## Prerequisites

Read up on the following materials,

* [`K8s` Concepts](https://kubernetes.io/docs/concepts/)
* [`kubectl` cheatsheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/)

## Requirements

* `kubectl` [Installation Guide](https://kubernetes.io/docs/tasks/tools/)

## Setup

To access the K8s cluster, you will need to have a `k3s.yaml` credential file. It can be obtained by ssh into the `master` node of the cluster, under the directory `/etc/rancher/k3s/k3s.yaml`.

Once you have obtained the `k3s.yaml` file, make the following modification,

```diff
# Update with the IP of the master node
- server: https://localhost:6443
+ server: https://123.123.123.123:6443
```

After the modification, this file is ready for use. Update your shell to always use this file,

```bash
export KUBECONFIG=/.../k3s.yaml
```

To confirm it working,

```bash
kubectl get pods --all-namespaces
```

## Common Operations

### See all nodes in cluster

```bash
kubectl get nodes
```

### See a specific node

```bash
kubectl describe node robotics-rover1
```

### See all deployed pods

* Notice that `-n clouddesktop-prod` refers to the clouddesktop-prod k8s `namespace`

```bash
kubectl -n clouddesktop-prod get pods
```

### See a specific pod

```bash
kubectl -n clouddesktop-prod describe pod julianho-clouddesktop-deployment-abc123efg-123abc
```

### Draining a node

```bash
kubectl drain robotics-rover2
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://campus-rover.gitbook.io/lab-notebook/fiiva/vnc-cluster/operation-guide/operating/cluster.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
