Kubernetes Access
Access to the cluster is controlled using . 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
Setup KubeConfig
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
kubectl
Nodes (no)
Time to see how many nodes we have. How do we get the list of the nodes
Namespace (ns)
List all namespaces
Create a namespace
Show namespace object in yaml
Lets make our life easier, and use this namespace by default
use namespace
> kubectl config set-context --current --namespace=kooper Context "k8s-class" modified.
Simple yaml file for pods:
my first pod
apiVersion: v1 kind: Pod metadata: name: cowsay namespace: kooper spec: restartPolicy: Never containers: - name: cowsay image: rancher/cowsay
Check the output (log) of the pods:
Before we can change anything, we first need to delete that pod
Make sure the cow goes Mooooo
Debugging if somethings goes wrong
Debug pods
> kubectl describe pod cowsay Name: cowsay Namespace: kooper Priority: 0 Node: k8s-class-worker-01/192.168.2.42 Start Time: Sun, 25 Jun 2023 09:52:44 -0500 Labels: <none> Annotations: <none> Status: Failed ... Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 5s default-scheduler Successfully assigned kooper/cowsay to k8s-class-worker-01 Normal Pulling 5s kubelet Pulling image "rancher/cowsay" Normal Pulled 5s kubelet Successfully pulled image "rancher/cowsay" in 321.252759ms Normal Created 5s kubelet Created container cowsay Warning Failed 5s kubelet Error: failed to start container "cowsay": Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "Mooooo": executable file not found in $PATH: unknown