🔹 Day 64 of #100DaysOfDevOps — Troubleshooting a Broken Python App on Kubernetes 🔹 Today’s task was not about deploying from scratch, but about debugging a broken Kubernetes application — exactly the kind of issue you face in real projects. A Python (Flask) app was already deployed, but it was not coming up and was not accessible via NodePort. 🔍 Step 1: Checked Deployment & Pod Status Started with the basics: kubectl get deploy kubectl get pods The pod was stuck in: ImagePullBackOff 🔎 Step 2: Used kubectl describe to Find the Root Cause kubectl describe pod <pod-name> From the Events section, it was clear that Kubernetes was failing to pull the image due to an incorrect image name. 🛠 Step 3: Fixed the Image Issue Using kubectl edit Edited the deployment directly: kubectl edit deployment python-deployment-xfusion Corrected the container image name Saved and exited the editor Kubernetes automatically recreated the pod, and this time it moved to Running state. ✅ 🔌 Step 4: Fixed the Service Port Misconfiguration Even after the pod was running, the app wouldn’t have been reachable because the Service was pointing to the wrong target port. Checked the Service: kubectl describe svc python-deployment-xfusion Then fixed it using: kubectl edit svc python-deployment-xfusion Updated targetPort from 8080 ➝ 5000 (Flask default port) Ensured nodePort was set to 32345 ✅ Final Result Deployment status: READY 1/1 Pod status: Running Application accessible via NodePort 32345 🧠 Key Learning This task reinforced that most Kubernetes issues are configuration mismatches, and the fastest way to debug them is: kubectl get → check status kubectl describe → read Events carefully kubectl edit → fix directly and let Kubernetes self-heal Real DevOps work is less about YAML creation and more about systematic troubleshooting. #100DaysOfDevOps #Day64 #Kubernetes #DevOps #Python #Flask #Containers #Debugging #LearningByDoing #CloudEngineering #kubectl
Troubleshooting a Broken Kubernetes Python App with kubectl
More Relevant Posts
-
Really great post by Python Snacks that discusses the use of Depot, which is a framework that speeds up your builds compared to the usual Docker setup that most of us are used to. The thing that really caught my attention was, with a setup the author used, they saw a speedup of 33.94% compared to Docker! Incredible! The benefits, while great for people doing solo development, really seem to compound when looked at in a team setting. If someone on your team builds with Depot, the rest of the group can skip that build process, due to the fact that Depot caches that build on their server! If you weren't already sold, it can work as a drop-in replacement in Docker and CI workflows. #Python #PythonSnacks #Depot #Docker #DevOps #CICD #CI #CD #BuildTools #BuildAutomation #SoftwareEngineering #DeveloperExperience #DX #DeveloperTools #Infrastructure #CloudNative #Containers #Containerization #Kubernetes #PlatformEngineering #MLOps #Automation #EngineeringProductivity #Caching #BuildCaching #RemoteCaching #BuildAcceleration #Performance #DeveloperProductivity #TeamCollaboration #DevWorkflow #ComputerScience
To view or add a comment, sign in
-
𝐃𝐞𝐯𝐎𝐩𝐬 𝟏𝟎𝟏 𝐟𝐨𝐫 𝐏𝐲𝐭𝐡𝐨𝐧𝐢𝐬𝐭𝐚𝐬 🐍 | 𝐖𝐞𝐞𝐤 𝟑: 𝐘𝐨𝐮𝐫 𝐈𝐧𝐟𝐫𝐚𝐬𝐭𝐫𝐮𝐜𝐭𝐮𝐫𝐞 𝐢𝐬 𝐣𝐮𝐬𝐭 "𝐂𝐨𝐝𝐞" Why struggle with static configuration files when you already speak a language designed for automation? 💡 𝐓𝐡𝐞 𝐅𝐚𝐜𝐭: Infrastructure as Code (IaC) is the practice of managing your servers, networks, and environments through machine-readable files. For a Python developer, this means treating your setup exactly like your application logic. Why Python is the secret weapon for Infrastructure: 🏗️ 𝐋𝐨𝐠𝐢𝐜 𝐨𝐯𝐞𝐫 𝐋𝐢𝐬𝐭𝐬 Static files are great for simple setups, but real-world infrastructure is complex. Python allows you to use if-else statements and loops to handle different environments (Prod vs. Dev) without duplicating thousands of lines of configuration. 🧪 𝐓𝐞𝐬𝐭𝐚𝐛𝐢𝐥𝐢𝐭𝐲 𝐛𝐲 𝐃𝐞𝐬𝐢𝐠𝐧 When your infrastructure is defined in Python, you can use your existing testing frameworks to validate it. You can catch configuration errors—like an insecure port or a missing disk volume—long before the "real" hardware is even touched. 🛠️ 𝐄𝐱𝐭𝐞𝐧𝐬𝐢𝐛𝐢𝐥𝐢𝐭𝐲 Need to calculate IP ranges, fetch metadata from an external API, or integrate a custom naming convention? Python’s standard library and ecosystem make these complex tasks trivial compared to restricted configuration languages. 🔄 𝐓𝐡𝐞 "𝐒𝐢𝐧𝐠𝐥𝐞 𝐒𝐨𝐮𝐫𝐜𝐞 𝐨𝐟 𝐓𝐫𝐮𝐭𝐡" By using Python for both your app and your setup, you bridge the gap between "it runs on my machine" and "it runs in production." Your infrastructure becomes version-controlled, peer-reviewed, and repeatable. 𝐓𝐡𝐞 𝐁𝐨𝐭𝐭𝐨𝐦 𝐋𝐢𝐧𝐞: Infrastructure as Code is not about learning a new "tool." It’s about applying the software engineering principles you already know—modularity, testing, and reuse—to the environment your code lives in. #Python #DevOps #IaC #SoftwareEngineering #Automation #InfrastructureAsCode
To view or add a comment, sign in
-
Built & Pushed My First Docker Image I took a solid step forward in my Docker journey by creating my first Docker image, running it successfully, and pushing it to Docker Hub. What I built: I created a Python + Flask based Docker image that runs a small web service. When the container starts, the application: - Runs a Flask web server - Displays the current date & time - Shows the container hostname (to prove it’s running inside Docker) - Listens on port 5000 This experience helped me clearly understand: - How Docker images are built - How dependencies are installed inside the image - How ENTRYPOINT and CMD work together - How containers are isolated from the local environment Image details: Docker Image: kuberanit/date-api:v1 How to test it yourself: If anyone wants to try it out, you can pull and run the image using: docker pull kuberanit/date-api:v1 docker run -p XXXX:5000 kuberanit/date-api:v1 (Note: Instead of XXXX, use any open port that is available in your host machine.) Then open your browser: http://localhost:5000 You should see the app running live. What this image demonstrates: - A reproducible Python environment - Dependency management using requirements.txt - A containerized web service that runs the same everywhere - A beginner-friendly but real Docker workflow Learning Docker step by step and finally seeing the app work inside a container feels really rewarding. Onward to more containerized projects. #Docker #DevOps #Containers #Python #Flask #LearningByDoing #DockerHub #CloudNative
To view or add a comment, sign in
-
-
Stop shipping "bloated" 1GB Docker images that take an eternity to build and deploy. Get the Docker Hub Toolkit for Claude Code here: 👉 https://lnkd.in/dgk55CKx Give it a star ⭐ and let us know if it speeds up your Docker-Hub workflow! Containerizing Python applications is often a trade-off between speed, size, and security. Most developers settle for "good enough" Dockerfiles that slow down CI/CD pipelines and increase the attack surface. We’ve built the Docker Hub Toolkit, a production-grade skill for Claude Code designed to automate the heavy lifting of end-to-end Docker deployment with industry-best practices baked in. What makes this toolkit a game-changer? Extreme Image Optimization: Automatically generates 4-stage Dockerfiles that shrink Python images from ~1GB to ~150MB using python:3.12-slim. Lightning-Fast Rebuilds: Implements BuildKit cache mounts (--mount=type=cache) so your dependency installation doesn't restart from scratch every time you change a line of code. The 10-Point Quality Gate: Includes an automated validation script that checks for non-root users, secret leaks, and layer ordering before you ever push to the hub. CI/CD on Autopilot: Generates complete Docker Hub Actions workflows featuring Docker Scout vulnerability scanning and multi-platform (amd64/arm64) support. Production-Ready by Default This isn't just about writing a file; it's about a standardized engineering workflow: Generate optimized multi-stage builds. Validate against security best practices. Build & Tag using semantic versioning and Git SHAs. Secure via Docker Scout scanning. Deploy with integrated GitHub Actions templates. Why use a Claude Skill for this? Instead of manually managing .dockerignore files or troubleshooting cross-platform buildx errors, you can now delegate the entire containerization strategy to Claude. It ensures consistency across your team and eliminates the "it worked on my machine" Docker headache. Ready to optimize your deployment? Check out the documentation and scripts in the repository: 👇 https://lnkd.in/dgk55CKx #Docker #Python #DevOps #ClaudeCode #CloudNative #GitHubActions #SoftwareEngineering #Containerization
To view or add a comment, sign in
-
-
🚀 𝗗𝗮𝘆 𝟭𝟬/𝟭𝟬𝟬: 𝗦𝘁𝗲𝗽𝗽𝗶𝗻𝗴 𝗶𝗻𝘁𝗼 𝘁𝗵𝗲 𝗪𝗼𝗿𝗹𝗱 𝗼𝗳 𝗣𝘆𝘁𝗵𝗼𝗻 After setting up the infrastructure yesterday, today was all about the language that 𝘁𝗶𝗲𝘀 it all together. 𝗣𝘆𝘁𝗵𝗼𝗻 It's not just a language; it's like the ultimate 𝘁𝗼𝗼𝗹𝗸𝗶𝘁 for automating all sorts of tasks. 𝗪𝗵𝗮𝘁 𝗜 𝗹𝗲𝗮𝗿𝗻𝗲𝗱 𝘁𝗼𝗱𝗮𝘆: • 𝗛𝗶𝗴𝗵-𝗟𝗲𝘃𝗲𝗹 & 𝗜𝗻𝘁𝗲𝗿𝗽𝗿𝗲𝘁𝗲𝗱: Python is human-readable and doesn't need a separate compilation step like 𝘊++. It’s executed line-by-line by an interpreter, making debugging much faster. • 𝗗𝘆𝗻𝗮𝗺𝗶𝗰 𝗧𝘆𝗽𝗶𝗻𝗴: You don't have to tell Python that a variable is a number or a string; it figures it out on the fly. This makes writing scripts incredibly fluid. • 𝗗𝗮𝘁𝗮 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲𝘀: Deep-dived into 𝘓𝘪𝘴𝘵𝘴 (ordered collections) and 𝘋𝘪𝘤𝘵𝘪𝘰𝘯𝘢𝘳𝘪𝘦𝘴 (Key-Value pairs). Understanding these is crucial because almost every 𝘈𝘗𝘐 response (like from AWS) comes back in a format that mirrors these structures. • 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀 & 𝗢𝗯𝗷𝗲𝗰𝘁𝘀: Learned how to wrap logic into reusable functions and how Python treats everything as an 𝘖𝘣𝘫𝘦𝘤𝘵, which gives it its massive flexibility. 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗲 & 𝗜𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁𝗮𝘁𝗶𝗼𝗻: I've started documenting my progress and solving real-world DevOps logic problems using Python. You can check out my script solutions here: 🔗 GitHub Repo: https://lnkd.in/gWFtZ7v9 𝗧𝗵𝗶𝗻𝗴𝘀 𝗜 𝗲𝘅𝗽𝗹𝗼𝗿𝗲𝗱 𝗼𝘂𝘁 𝗼𝗳 𝗰𝘂𝗿𝗶𝗼𝘀𝗶𝘁𝘆: • 𝗔𝗹𝗶𝗮𝘀𝗶𝗻𝗴: Tired of typing python3? I mapped it to 𝘗𝘺𝘵𝘩𝘰𝘯 by adding alias python=python3 to my .𝘻𝘴𝘩𝘳𝘤 file. It makes the workflow much faster. • 𝗣𝘆𝘁𝗵𝗼𝗻 𝗢𝗳𝗳𝗶𝗰𝗶𝗮𝗹 𝗜𝗻𝘁𝗲𝗿𝗽𝗿𝗲𝘁𝗲𝗿: Found a cool way to test code snippets without a local setup using the 𝘸𝘦𝘣-𝘣𝘢𝘴𝘦𝘥 𝘴𝘩𝘦𝘭𝘭 at https://lnkd.in/gaHn8Upt bongoDev #DevOps #Python #Coding #Automation #100DaysOfDevOps #Programming #Scripting #BackendDevelopment #TechLearning
To view or add a comment, sign in
-
-
This Python script automates enabling and disabling New Relic alerts based on a custom schedule - ideal for maintenance windows, off-hours, or reducing alert noise. Using the NerdGraph API, it seamlessly integrates with your monitoring setup. Key highlights: 📌 Easy config via JSON (set times, API keys) 📌 Manage alert conditions with a simple CSV 📌 Runs continuously in the background 📌 Perfect for DevOps teams looking to streamline alert management without manual toggling. Check it out on GitHub: https://lnkd.in/gcVGi5K4 Have you dealt with similar alert challenges? Drop your thoughts below! #Python #DevOps #NewRelic #OpenSource #Automation
To view or add a comment, sign in
-
✍ Documenting and Containerizing My First Docker Project 🐳📄 Today I didn’t just build a Docker image I also documented the entire workflow in a clean README. This project shows: A Python app running inside a Docker container Environment variables controlling runtime behavior A clear Dockerfile and .dockerignore A step-by-step README to build and run the image From: docker build -t docker-basics:1.0 . docker run --rm -e STUDENT_NAME=Alice docker-basics:1.0 To a fully reproducible setup anyone can run. This is what DevOps is about: build once, run anywhere, and document so others can follow. Learning by doing. One container at a time. 🚀 #Docker #DevOps #Python #OpenSource #LearningJourney #TechSkills
To view or add a comment, sign in
-
-
It may sound obvious to talk about this, but I’ve often seen sensitive data such as credentials, API keys, etc. hard-coded during code reviews. Never leave credentials in settings.py. Use python-decouple + .env for secrets. And remember .env should never go to Git. Have you ever found exposed secrets in projects? hashtag #Django hashtag #Python hashtag #BestPractices
To view or add a comment, sign in
-
🚀 𝗗𝗮𝘆 𝟭𝟭/𝟭𝟬𝟬: 𝗣𝘆𝘁𝗵𝗼𝗻 𝗳𝗼𝗿 𝗦𝘆𝘀𝘁𝗲𝗺𝘀 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗼𝗻 Yesterday was about the "𝐠𝐫𝐚𝐦𝐦𝐚𝐫" of Python. Today was about using that grammar to actually talk to the 𝐎𝐩𝐞𝐫𝐚𝐭𝐢𝐧𝐠 𝐒𝐲𝐬𝐭𝐞𝐦 and solve real-world problems. 𝗪𝗵𝗮𝘁 𝗜 𝗹𝗲𝗮𝗿𝗻𝗲𝗱 𝘁𝗼𝗱𝗮𝘆: • 𝗖𝗼𝗻𝘁𝗿𝗼𝗹 𝗙𝗹𝗼𝘄: Mastered Conditions (𝘪𝘧/𝘦𝘭𝘪𝘧/𝘦𝘭𝘴𝘦) and Loops (𝘧𝘰𝘳/𝘸𝘩𝘪𝘭𝘦) to handle decision-making in scripts. • 𝗟𝗶𝘀𝘁 𝗖𝗼𝗺𝗽𝗿𝗲𝗵𝗲𝗻𝘀𝗶𝗼𝗻: A Pythonic way to create lists in a single line, 𝘤𝘭𝘦𝘢𝘯𝘦𝘳, 𝘧𝘢𝘴𝘵𝘦𝘳, and more 𝘳𝘦𝘢𝘥𝘢𝘣𝘭𝘦 code. • 𝗧𝘂𝗽𝗹𝗲𝘀: Learned why we use these "𝘪𝘮𝘮𝘶𝘵𝘢𝘣𝘭𝘦" lists when we need data that shouldn't be changed by mistake. • 𝗕𝗮𝘀𝗵 𝘃𝘀. 𝗣𝘆𝘁𝗵𝗼𝗻: While Bash is king for simple command-line tasks, Python shines when the logic gets complex, needs better error handling, or requires heavy data manipulation. 𝗧𝗵𝗲 "𝗗𝗲𝘃𝗢𝗽𝘀" 𝗠𝗼𝗱𝘂𝗹𝗲𝘀: • 𝗼𝘀 & 𝘀𝗵𝘂𝘁𝗶𝗹: The bread and butter of 𝘢𝘶𝘵𝘰𝘮𝘢𝘵𝘪𝘰𝘯. Used these to navigate directories, move files, and interact with the underlying system. • 𝗱𝗮𝘁𝗲𝘁𝗶𝗺𝗲: Essential for 𝘵𝘪𝘮𝘦-𝘴𝘵𝘢𝘮𝘱𝘪𝘯𝙜 𝘭𝘰𝙜𝘴 and scheduling cleanup tasks based on file age. 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗲 & 𝗜𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁𝗮𝘁𝗶𝗼𝗻: I put these modules to work by building a Log Archiver. It’s a script that identifies old logs and zips them up to save disk space, a classic DevOps scenario. 🔗 𝙂𝙞𝙩𝙃𝙪𝙗 𝙍𝙚𝙥𝙤: https://lnkd.in/gcXubqjg bongoDev #DevOps #Python #Automation #LogManagement #100DaysOfDevOps #Coding #SystemsAdministration #GitHub #Scripting
To view or add a comment, sign in
-
-
Day 96 of Backend/Cloud/DevOps Journey - Debugging bcrypt Compatibility Issues Today was all about real-world debugging. Spent the session troubleshooting a passlib/bcrypt compatibility issue that persisted even after switching Python versions. What I accomplished: • Installed Python 3.12 via Homebrew to replace Python 3.14 (learned that compilation from source takes time due to C extension building) • Discovered the issue wasn't Python version but bcrypt library version incompatibility with passlib • Pinned bcrypt to version 4.0.1 to resolve passlib's internal self-test failures • Successfully tested all auth utilities: hash_password, verify_password, create_access_token, verify_token • Learned why pinning dependency versions in requirements.txt prevents environment inconsistencies across deployments • Updated verify_token() to include algorithms parameter for security best practices Technical insights: • Homebrew's "make" step compiles C source code to machine code which is CPU-intensive and time-consuming • Virtual environments are tied to the Python version that created them—you cannot switch versions without recreating the venv • The bcrypt 72-byte password limit caused passlib's detect_wrap_bug() self-test to fail on newer bcrypt versions (4.1+) • Pinning dependencies (bcrypt==4.0.1) ensures consistent behavior across development, staging, and production environments • The algorithms parameter in jwt.decode() prevents algorithm confusion attacks—always specify explicitly • Real-world debugging often means the obvious fix (switching Python versions) doesn't work and requires deeper investigation • Library compatibility issues are common in production—this is why teams use stable Python versions not bleeding edge Key lesson: When an error persists after the "obvious" fix, dig deeper into the dependency chain. The root cause was bcrypt library version, not Python version. Auth system now fully functional: password hashing with bcrypt salting, password verification, JWT creation with expiration, and token decoding with validation. Next steps: Complete User model in SQLAlchemy, create users table, build registration and login endpoints. #100DaysOfCode #Python #FastAPI #Debugging #bcrypt #DependencyManagement #BackendDevelopment #CloudEngineering #DevOps #LearningInPublic #TechCareer #BuildInPublic
To view or add a comment, sign in
Explore related topics
- Steps to Debug Kubernetes Issues Locally
- Troubleshooting Unreachable Kubernetes Pods
- How to Debug Code in Kubernetes Pods
- Troubleshooting Kubernetes Rollout and Storage Issues
- Common Kubernetes Mistakes in Real-World Deployments
- Resolving Kubernetes Deployment Issues in Norway
- Kubernetes Deployment Tactics
- How to Automate Kubernetes Stack Deployment
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development