• DevOps
    Case Study

    How we helped a development company rebuild DevOps for efficiency and scale.

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How a US hosting leader scaled with us!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    Enabling financial grade platforms through strategic cloud modernisation.

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • K8s
  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Contact Us

Interested to collaborate?

Get in touch with us!

Contact us today to learn how our team can help you leverage our managed cloud and DevOps services so you can focus on growing your business.

  • White Label Managed IT Services for MSPs
  • White Label MSP Support Services
  • Managed HelpDesk Services
  • White Label WordPress Maintenance Services
  • Outsourced WebHosting Support
  • Hosting HelpDesk Support Services
  • cPanel Server Management
  • Plesk Server Management
  • DevOps Automation Services
  • DevOps Containerization Services
  • DevOps Engineering Services Experts
  • DevOps Maturity Assessment
  • DevOps Testing Services & Automation
  • DevOps Implementation Services
  • DevOps Transformation Services
  • White Label Kubernetes IT Services
  • Cloud Automation Services
  • Cloud Modernization Services
  • Database Migration Services
  • DevOps Outsourcing Services

AWS

  • AWS DevOps Services for Scalable Cloud
  • AWS Well-Architected Review
  • AWS Migration Services

Azure

  • Azure DevOps Services & Automation
  • Azure Migration Services

Google Cloud

  • Google Cloud Managed Services
  • Google Cloud Migration Services
  • Google Cloud Platform Services
  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Managed DigitalOcean Cloud
  • Managed OVH Cloud
  • Managed Hetzner Cloud
  • Managed Akamai Cloud
  • Oracle Managed Services
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us
  • Sitemap

aws partneraws advanced partner
LinkedInFacebookXInstagramYouTube
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

kubectl Command Center: The Sage's Essentials

Author Profile
Sarah
  • 3 min read
kubectl Command Center: The Sage's Essentials

Generating audio, please wait...

When working with Kubernetes from notebooks, CI/CD pipelines, or day-to-day operations, troubleshooting quickly is essential. A few well-chosen kubectl commands can help you identify failing workloads, inspect logs, navigate namespaces, and recover services faster.

This guide expands on the kubectl cheat sheet and provides detailed explanations, practical examples, and troubleshooting workflows that notebook users can reference when issues arise. 

1. Create a Faster Workflow with Aliases

Typing kubectl repeatedly can slow you down. Create an alias:

alias k='kubectl'

Add it to your shell profile (~/.bashrc, ~/.zshrc) to make it permanent.

Why it helps

Faster command execution

Easier notebook snippets

Cleaner examples in documentation

2. The “What’s Broken?” View

When something fails, start by checking which pods are not healthy.

k get pods -A --field-selector=status.phase!=Running

What it does

-A: checks all namespaces
Filters pods not in Running state

Quickly exposes Pending, CrashLoopBackOff, Error, or Completed

Typical Issues

  • Image pull failures
  • Resource shortages
  • Startup crashes
  • Misconfigured secrets/configmaps

Recommended Next Step

Pick a failing pod and inspect details:

k describe pod <pod-name> -n <namespace>

3. Sort Events to Find Recent Failures

Events often explain what happened moments before an outage.

k get events -A --sort-by='.lastTimestamp'

4. Context & Namespace Navigation

Managing multiple clusters or namespaces can cause accidental deployments to the wrong environment.

View Current Context

k config get-contexts

Switch Namespace (with kubens)

kubens <namespace>

Why This Matters in Notebooks

If your notebook runs commands against the wrong cluster, results may be misleading. Always verify context before troubleshooting.

5. Deep Dive Debugging

Stream Logs

k logs -f <pod-name> --tail=100

Why it helps

  • Shows last 100 lines immediately
  • Continues streaming live logs
  • Useful for startup failures and intermittent crashes

If Multiple Containers Exist

k logs <pod-name> -c <container-name>
Promotional banner

6. Launch a Temporary Debug Container

Sometimes production containers are minimal and lack tools like curl, ping, or nslookup.

k run debug-shell --rm -it --image=busybox -- /bin/sh

Use It For

  • DNS resolution tests
  • Network connectivity checks
  • Service reachability
  • Internal API validation

Example

wget -qO- http://my-service:8080/health

7. Inspect Pod Lifecycle & Exit Codes

k describe pod <pod-name> | grep -C 5 State

Common Exit Codes

CodeMeaning
1Generic application error
127Command not found
137Out of memory (OOMKilled)
143Graceful termination

If You See 137: Increase memory requests/limits or investigate memory leaks.

8. Resource Management

Force Delete a Stuck Pod

k delete pod <pod-name> --grace-period=0 --force

Use Carefully

Only use when a pod is stuck in Terminating and normal deletion fails.

9. Check Cluster Resource Pressure

k top nodes
k top pods

Requires

Metrics Server installed in the cluster.

Useful For

  • CPU bottlenecks
  • Memory pressure
  • Identifying noisy neighbors
  • Capacity planning

10. Port Forwarding: The Quick Fix

Need temporary access to a service without exposing ingress?

k port-forward svc/<service-name> 8080:<service-port>

Then open:

http://localhost:8080

Great For

  • Testing APIs locally
  • Accessing dashboards
  • Debugging internal services
  • Secure temporary access

Conclusion

Kubernetes troubleshooting becomes much easier when you follow a consistent workflow. These kubectl commands help reduce mean time to resolution (MTTR) and give notebook users a reliable path from symptom to solution.

Keep this guide linked in your notebook so users can jump directly into deeper troubleshooting whenever needed.

  • Kubernetes

Continue Your Journey With…

DevOps as a Service

DevOps as a Service

Let us do the heavy lifting for you

Promotional banner
Promotional banner
kubectl Command Center: The Sage's Essentials

AWS Architect's Map: Decision and Governance

AWS Architect's Map: Decision and Governance
  • AWS
  • Security
logo

Benefits of DevOps as a Service: What Your Business Actually Gains

Benefits of DevOps as a Service: What Your Business Actually Gains
  • DevOps
  • Security
logo

Cloud Security: The Sage’s Hardening Handbook (AWS Edition)

Cloud Security: The Sage’s Hardening Handbook (AWS Edition)
  • DevOps
  • AWS
logo

DevOps as a Service Pricing: What Factors Determine What You Pay

DevOps as a Service Pricing: What Factors Determine What You Pay
  • DevOps
  • Kubernetes
  • AWS
  • Azure
logo

Posts by Sarah