You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 6
Next »
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
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
Nodes (no)
Time to see how many nodes we have. How do we get the list of the nodes
> 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 (ns)
List all namespaces
> kubectl get namespace
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
> kubectl create namespace kooper
namespace/kooper created
Show namespace object in yaml
> kubectl get namespace kooper -o 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
> kubectl config set-context --current --namespace=kooper
Context "k8s-class" modified.
Pods (po)
Simple yaml file for pods:
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:
> kubectl logs pod/cowsay
_
< >
-
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Make sure the cow goes mooooo
apiVersion: v1
kind: Pod
metadata:
name: cowsay
namespace: kooper
spec:
restartPolicy: Never
containers:
- name: cowsay
image: rancher/cowsay
command:
- cowsay
- Mooooo
Storage
Storage Classes
Persistant Volume Claims
Persistant Volume
Deployment
Stateful Set
Ingress
Ingress Controller
Ingress