Search By Label
kubectl logs <pod-id> --previous
kubectl get pod celery-worker-5558fbffb-25dmw -o jsonpath="{.status.containerStatuses[0].lastState.terminated.reason}"docker run -it <image_id> /bin/bash
Flask applications.Blueprint, routes, resource etc).thistuple = ("apple", "banana", "cherry")
print(thistuple) // ('apple', 'banana', 'cherry')kubectl create secret generic <secret-name> --from-file=key.json=gcloud_keys.json -n <namespace>
key.json file from our local file gcloud_keys.json kubectl describe secret <secret_name> -n <namespace>
kubectl get secret <secret_name> -n <namespace> -o jsonpath="{.data.key\.json}" | base64 --decode-- Selecting and unnesting an array of integers
SELECT
unnest(ARRAY[1, 2]); -- Expands the array [1, 2] into individual rows-f flag:-f, --follow=false: Specify if the logs should be streamed.
kubectl logs -f <pod_name>
kubectl rollout restart deployment
kubectl get deploy deploymentname -o yaml
kubectl create configmap <name-configmap> --from-env-file=.env
kubectl get configmap <name-configmap> -o yaml
kubectl edit configmap <name-configmap>
envFrom:
- configMapRef:
name: <name-configmap>
kubectl get pods -n dev, you're retrieving the list of the pods located under the namespace 'dev'.kubectl get deployments -n dev, you're retrieving the list of the deployments located under the namespace 'dev'.kubectl get podskubectl get deploymentskubectl config get-contexts
kubectl config delete-context <context-name>
kubectl create namespace <name>