Pages

Wednesday, May 24, 2023

Kubernetes Commands

 To create A service account - imperatively - kubectl create serviceaccount k8s-svc-account


Declarative way of creating a service account

apiVersion: v1
kind: ServiceAccount
metadata:
  name: k8s-svc-account
Listing service accounts - kubectl get serviceaccounts

Rendering service account details - kubectl describe serviceaccount k8s-svc-account

Listing roles - kubectl get roles

Listing deployments - kubectl get deployments

Deleting deployments - kubectl delete deployment myapp

Initializing Control Plane node

kubeadm init --pod-cidr 172.16.0.0/16 --apiserver-advertise-address 10.1.1.1

Deploy a Container Network Interface (CNI) plugin so that the pods can communicate with each other

kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version= $(kubectl version | base64 | tr -d '\n')"

Verify if the control plane node indicates "Ready" status using - kubectl get nodes


Joining Worker nodes - kubeadm join 10.1.1.1:6443 --token xxxxxxx ssh256:xxxxx

Creating roles - imperative approach
$ kubectl create role read-only --verb=list,get,watch \
  --resource=pods,deployments,services
role.rbac.authorization.k8s.io/read-only created

No comments:

Post a Comment