Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Kubernetes Access

Access to the cluster is controlled using SUSE Rancher. You can login with your NCSA credentials. You should see a list of all the clusters you have access, you want to download the config for k8s-class

Code Block
languagebash
export KUBECONFIG=~/k8s-class.yaml
kubectl version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.24.15
Kustomize Version: v4.5.4
Server Version: v1.24.9

...

We can see that we have access to the cluster (running kubernetes 1.24.9)

Lets also check what other commands we can do

Code Block
languagebash
kubectl

...

Nodes

Time to see how many nodes we have. How do we get the list of the nodes

Code Block
languagebash
collapsetrue
> kubectl get nodes
NAME                        STATUS   ROLES               AGE    VERSION
k8s-class-controlplane-01   Ready    controlplane,etcd   128m   v1.24.9
k8s-class-controlplane-02   Ready    controlplane,etcd   89m    v1.24.9
k8s-class-controlplane-03   Ready    controlplane,etcd   86m    v1.24.9
k8s-class-worker-01         Ready    worker              126m   v1.24.9
k8s-class-worker-02         Ready    worker              126m   v1.24.9
k8s-class-worker-03         Ready    worker              90m    v1.24.9



## Namespace


List all namespaces


<details>
  <summary>kubectl .......</summary>
 kubectl get namespace
</details>


```
NAME                          STATUS   AGE
cattle-fleet-system           Active   128m
cattle-impersonation-system   Active   129m
cattle-system                 Active   129m
cinder-csi                    Active   125m
default                       Active   130m
kube-node-lease               Active   130m
kube-public                   Active   130m
kube-system                   Active   130m
local                         Active   128m
metallb-system                Active   122m
nfs-taiga                     Active   122m
traefik                       Active   122m
```


Create a namespace


<details>
  <summary>kubectl .......</summary>
 kubectl create namespace kooper
</details>


Show namespace file


<details>
  <summary>kubectl .......</summary>
 kubectl get ns kooper -o yaml 
</details>


```yaml
apiVersion: v1
kind: Namespace
metadata:
  annotations:
    cattle.io/status: '{"Conditions":[{"Type":"ResourceQuotaInit","Status":"True","Message":"","LastUpdateTime":"2023-06-25T13:35:36Z"},{"Type":"InitialRolesPopulated","Status":"True","Message":"","LastUpdateTime":"2023-06-25T13:35:36Z"}]}'
    lifecycle.cattle.io/create.namespace-auth: "true"
  creationTimestamp: "2023-06-25T13:35:35Z"
  finalizers:
  - controller.cattle.io/namespace-auth
  labels:
    kubernetes.io/metadata.name: kooper
  name: kooper
  resourceVersion: "296036"
  uid: 6c4092ca-4024-4814-a2c0-5739777ea3aa
spec:
  finalizers:
  - kubernetes
status:
  phase: Active
```


Lets make our life easier, and use this namespace by default


```bash
kubectl config set-context --current --namespace=kooper
```


Expand
titlelist nodes



Info

...