Commands
  • About
  • Software Development
    • Glossary
    • System Design
      • CAP Theorem
      • Data Migration
      • EAV Model
      • ETL Process
      • Event Sourcing
      • Outbox Pattern
      • SOLID Principles
    • Standards
      • Character Encoding
      • Twirp
    • Elixir
      • IEx
      • Mix
      • Libraries
      • Code Snippets
    • Node.js
      • TypeScript
  • Commands
    • Bookmarks
    • AWS
      • Athena
      • ECS
    • Docker
      • Manage Images
      • Manage Containers
    • File System
      • Grep
      • Search Files
      • Miscellaneous
    • Git
      • Setup New Project
      • Manage Remotes
      • Release Project
    • GPG
    • Kafka
      • Quick Start
    • Kubernetes
    • OpenShift
      • Manage Roles and Bindings
    • PostgreSQL
    • SSL / TLS
      • Common OpenSSL Commands
      • Create Self-signed Certificate
      • Java Truststore and Keystore
    • SSH
      • Key Management
      • Port Forwarding
    • YUM
      • List Repositories
      • List Packages
    • Miscellaneous
      • Network
Powered by GitBook
On this page
  • Cheat Sheet
  • Common Commands
  • Multi-cluster Management
  • Switch between Clusters
  1. Commands

Kubernetes

PreviousQuick StartNextOpenShift

Last updated 3 years ago

Cheat Sheet

Common Commands

# Set the default namespace
kubectl config set-context --current --namespace <NAMESPACE>

# List/Get the resource(s)
kubectl get <deployment|service|pod|...> [RESOURCE_NAME]

# Interactive shell access to a running pod
kubectl exec -it <POD_NAME> -- /bin/sh

Multi-cluster Management

Switch between Clusters

# List all contexts
kubectl config get-contexts

# Get current context
kubectl config current-context

# Switch to another context
kubectl config use-context <CONTEXT_NAME>
https://kubernetes.io/docs/reference/kubectl/cheatsheet/