My kubectl CheatSheet

Pods
List pods in current namespace

kubectl get pods

List pods i all namespaces

kubectl get pods -A

View details about a pod

kubectl describe pod <pod-name>

ConfigMaps
List ConfigMaps

kubectl get configmaps

View details about a ConfigMap

kubectl describe configmap <config-map-name>

Create a ConfigMap the holds a file

kubectl create configmap <config-map-name> --from-file=<file-name>

Deployments
List Deployments

kubectl get deployments

View details about a Deployment

kubectl describe deployment <deployment-name>

Services
List Services

kubectl get services

View details about a Service

kubectl describe service <service-name>

ServiceAccounts
List ServiceAccounts

kubectl get serviceaccounts

View details about a ServiceAccount

kubectl describe serviceaccount <service-account-name>

Secrets
List all secrets

kubectl get secrets

View details about a secret

kubectl describe secret <secret-name>

Get secret contents as JSON

kubectl get secret <secret-name> -o jsonpath='{.data}'

Create a secret with passwords

kubectl create secret generic <secret-name> --from-literal=username=<username> --from-literal=password='<password>'

Create a secret with files

kubectl create secret generic <secret-name> --from-file=truststore.jks --from-file=keystore.p12

Edit a secret

kubectl edit secrets <secret-name>

Delete a secret

kubectl delete secret <secret-name>

Logs
Setup “tail” on a pod. Here we want to see the last 500 lines of the log and setup a “tail” for new logs to the console

kubectl -n <namespace> logs -f --tail=500 --timestamps <exact-pod-name>

IntegrationPlattform
Get all objects of kind IntegrationPlattform

kubectl get IntegrationPlatform

View settings of the IntegrationPlattform

kubectl describe IntegrationPlatform <integration-plattform-name>

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.