🐥
The Tech Toolbox
Visit My Website!LinkedIn Profile
  • ✍️Introduction
  • ✍️Laptop Setup Guide
  • ✍️Quotes
  • Interview Preparation
    • 🔥Topics To Cover
    • 🔥System Design
    • 🔥Google Interview
      • Data Structures
      • Algorithms
      • System Design
      • Programming Concepts
      • Behavioral
    • 🔥Documents
  • Question Answers
    • ⭐Question Set 1
    • ⭐Question Set 2
    • ⭐Question Set 3
    • ⭐Microservice Architecture
    • ⭐Company-wise
      • Publicis Sapient
        • Core Java Section
        • Solutions & Tools
        • Microservices
        • Mix Questions
      • Mastercard
      • Finicity
  • Notes
    • 🎯Java Fundamentals
      • Time & Space Complexity
      • Design Patterns
      • Collections
      • Java 8 Features
      • JVM Internals
      • Generics
      • Multithreading
    • 🎯Spring Fundamentals
      • Spring Boot
      • Spring AOP
      • Spring Cloud
      • Spring Security
      • Spring Batch
    • 🎯Database
      • Oracle SQL
        • Aggregate Functions
      • MongoDB
        • Commands
        • Aggregate Query
      • Distributed Transaction
    • 🎯Apache Kafka
      • Kafka with Spring Boot
      • Partitions
    • 🎯Redis
    • 🎯Mockito
    • 🎯Docker
      • Commands
    • 🎯Kubernetes
      • Commands
    • 🎯Prometheus
    • 🎯Build Tools
      • Gradle
      • Apache Maven
    • 🎯Architecture
      • API and Integration Strategy
  • ⚓Developer Reference
    • ❄️GCP
    • ❄️Linux
  • Structured Learning Plan
    • 🍉Java Multithreading
    • 🍉Data Structures
    • 🍉Spring AOP
    • 🍉Transaction Management
    • 🍉MongoDB
    • 🍉Design Patterns
    • 🍉System Design
Powered by GitBook
On this page

Was this helpful?

  1. Notes
  2. Kubernetes

Commands

Basics

  1. Create a new deployment: kubectl create deployment [DEPLOYMENT_NAME] --image=[IMAGE_NAME]

  2. Scale a deployment: kubectl scale deployment [DEPLOYMENT_NAME] --replicas=[REPLICA_COUNT]

  3. Expose a deployment as a service: kubectl expose deployment [DEPLOYMENT_NAME] --port=[PORT_NUMBER] --target-port=[TARGET_PORT_NUMBER] --type=[SERVICE_TYPE]

  4. Delete a deployment: kubectl delete deployment [DEPLOYMENT_NAME]

  5. Delete a service: kubectl delete service [SERVICE_NAME]

  6. Get information about a deployment: kubectl get deployment [DEPLOYMENT_NAME]

  7. Get information about a service: kubectl get service [SERVICE_NAME]

Pods

  1. Create a new pod: kubectl run [POD_NAME] --image=[IMAGE_NAME]

  2. Delete a pod: kubectl delete pod [POD_NAME]

  3. Get information about a pod: kubectl get pod [POD_NAME]

  4. View logs from a pod: kubectl logs [POD_NAME]

  5. Execute a command inside a pod: kubectl exec [POD_NAME] -- [COMMAND]

ConfigMaps and Secrets

  1. Create a new ConfigMap: kubectl create configmap [CONFIGMAP_NAME] --from-literal=[KEY]=[VALUE]

  2. Create a new Secret: kubectl create secret generic [SECRET_NAME] --from-literal=[KEY]=[VALUE]

  3. Get information about a ConfigMap: kubectl get configmap [CONFIGMAP_NAME]

  4. Get information about a Secret: kubectl get secret [SECRET_NAME]

Namespaces

  1. Create a new namespace: kubectl create namespace [NAMESPACE_NAME]

  2. Switch to a different namespace: kubectl config set-context --current --namespace=[NAMESPACE_NAME]

  3. Get information about all namespaces: kubectl get namespaces

Advanced

  1. Apply a configuration file: kubectl apply -f [FILE_PATH]

  2. Get detailed information about a deployment: kubectl describe deployment [DEPLOYMENT_NAME]

  3. Get detailed information about a pod: kubectl describe pod [POD_NAME]

  4. Get detailed information about a service: kubectl describe service [SERVICE_NAME]

  5. Port-forward to a pod: kubectl port-forward [POD_NAME] [LOCAL_PORT]:[REMOTE_PORT]

PreviousKubernetesNextPrometheus

Last updated 2 years ago

Was this helpful?

🎯