Welcome again to the Kubernetes Mastery Collection! On this third half, we’ll delve into the world of Kubernetes sources and the right way to handle them successfully.
Earlier than we start, guarantee you’ve gotten your Kubernetes cluster up and operating. In the event you’ve been following together with the sequence, your KinD cluster ought to already be arrange.
Pods, Deployments, and Providers
1. Record Pods
# Record all pods within the default namespace
kubectl get pods
# Record pods in a particular namespace
kubectl get pods -n <namespace>
2. Describe a Pod
# Describe a pod by title
kubectl describe pod <pod-name>
3. Scale Deployments
# Scale a deployment to a desired variety of replicas
kubectl scale deployment/<deployment-name> --replicas=<desired-replicas>
4. Replace Deployments
# Replace the picture of a deployment
kubectl set picture deployment/<deployment-name> <container-name>=<new-image>
5. Create a Service
# Create a service to reveal a deployment
kubectl expose deployment <deployment-name> --port=<port> --target-port=<target-port> --type=NodePort
ConfigMaps and Secrets and techniques
6. Create a ConfigMap
# Create a ConfigMap from literal values
kubectl create configmap <configmap-name> --from-literal=<key1>=<value1> --from-literal=<key2>=<value2>
7. Create a Secret
# Create a Secret from literal values
kubectl create secret generic <secret-name> --from-literal=<key1>=<value1> --from-literal=<key2>=<value2>
Persistent Volumes and Persistent Quantity Claims
8. Create a Persistent Quantity (PV)
# Create a Persistent Quantity
kubectl apply -f pv.yaml
9. Create a Persistent Quantity Declare (PVC)
# Create a Persistent Quantity Declare
kubectl apply -f pvc.yaml
Namespaces
10. Create a Namespace
# Create a brand new namespace
kubectl create namespace <namespace-name>
These are just some examples of how one can work together with Kubernetes sources. Kubernetes presents a wealthy set of useful resource varieties for managing purposes and their configurations.
Keep tuned for the following half in our Kubernetes Mastery Collection:
Half 4 – Deploying Stateful Purposes