Guía de Despliegue de .NET 9 en AKS

Guía para desplegar .NET 9 en Azure Kubernetes Service AKS con contenedores, CI/CD y pruebas de salud, desde la creación hasta la entrega continua

15 sept 2025 • 4 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Introducción: Desplegar una aplicación .NET 9 en Azure Kubernetes Service AKS permite aprovechar arquitectura cloud native con escalabilidad y alto rendimiento. En esta guía práctica de Q2BSTUDIO, empresa de desarrollo de software y aplicaciones a medida especialista en inteligencia artificial y ciberseguridad, describimos un flujo completo desde la creación de la aplicación hasta su entrega continua en AKS. Q2BSTUDIO ofrece servicios de software a medida, soluciones de inteligencia artificial e integración con servicios cloud aws y azure para proyectos empresariales.

Requisitos previos: Instala y verifica las herramientas básicas: Visual Studio Code, .NET 9 SDK, Git, Docker Desktop, Azure CLI y kubectl. Opcionalmente instala GitHub CLI para gestionar repositorios. Asegúrate de iniciar Docker Desktop antes de usarlo y de autenticarte con az login para administrar recursos en Azure.

Crear la aplicación .NET: Crea un proyecto webapi minimal con dotnet new webapi -minimal y añade dependencias útiles como verificaciones de salud y documentación Swagger. Configura Kestrel para escuchar en el puerto 8080, añade endpoints para la raíz, un endpoint de ejemplo weather y un endpoint /health para probes de Kubernetes. Prueba localmente con dotnet run y visita las rutas / swagger / health y la raíz.

Contenerizar la aplicación: Crea un Dockerfile multi stage para construir, publicar y ejecutar la aplicación en una imagen optimizada basada en mcr.microsoft.com/dotnet/aspnet:9.0. Añade un archivo .dockerignore para excluir bin obj y archivos de IDE. Construye la imagen con docker build y pruébala con docker run y curl a los endpoints locales.

Infraestructura en Azure: En Azure crea un grupo de recursos con az group create y un Azure Container Registry ACR con az acr create usando un nombre único. Puedes construir y subir la imagen a ACR con az acr build. Crea un clúster AKS integrado con ACR usando az aks create con --attach-acr para que AKS pueda tirar imágenes sin secretos manuales. Obtén credenciales con az aks get-credentials y verifica con kubectl get nodes.

Configuración de Kubernetes: Prepara manifiestos YAML para Deployment y Service. Define probes liveness readiness y startup apuntando a /health, solicita recursos y publica el puerto 8080 internamente y expónlo externamente con un Service tipo LoadBalancer que dirija el puerto 80 al 8080 del contenedor. Aplica los manifiestos con kubectl apply -f y supervisa pods y servicios con kubectl get pods kubectl get services.

Integración continua y despliegue continuo: Inicializa un repositorio Git, crea un service principal en Azure para CI con az ad sp create-for-rbac y guarda las credenciales JSON en los secretos de GitHub. Crea un workflow de GitHub Actions que compile la solución con .NET 9, ejecute pruebas, haga login en ACR, construya y suba la imagen, y actualice el Deployment en AKS. Incluye pasos para pruebas rápidas del contenedor y comprobaciones de salud tras el despliegue.

Acceso a la aplicación desplegada: Obtén la IP externa del servicio con kubectl get service weather-app-service y prueba los endpoints públicos desde curl o el navegador incluyendo / swagger y / health. Ten en cuenta que la provisión de la IP externa puede tardar unos minutos según la configuración de la nube.

Prueba de despliegue continuo: Realiza un cambio simple en el código, sube el commit y observa cómo GitHub Actions reconstruye la imagen y actualiza el clúster AKS. Verifica que los pods se reciclan correctamente y que los endpoints públicos siguen respondiendo correctamente.

Limpieza de recursos opcional: Para evitar costes elimina recursos individuales como kubectl delete -f k8s az aks delete y az acr delete o elimina todo el resource group con az group delete para borrado masivo y rápido.

Por qué elegirnos: En Q2BSTUDIO combinamos experiencia en desarrollo de software a medida y aplicaciones a medida con capacidades avanzadas en inteligencia artificial y ciberseguridad para entregar soluciones seguras y escalables. Ofrecemos integración con servicios cloud aws y azure y soluciones de servicios inteligencia de negocio y power bi para extraer valor de los datos. Si buscas desarrollar un producto a medida con enfoque cloud y capacidades de agentes IA o ia para empresas, podemos ayudarte a diseñar la arquitectura, automatizar despliegues y asegurar tus aplicaciones.

Recursos y servicios relacionados: Conoce nuestras soluciones de desarrollo de aplicaciones y software a medida visitando Desarrollo de aplicaciones y software a medida en Q2BSTUDIO y descubre nuestros servicios de nube y migración en Servicios cloud AWS y Azure. Para proyectos orientados a inteligencia artificial explora nuestras propuestas de ia para empresas y agentes IA y para protección de infraestructuras consulta nuestras capacidades en ciberseguridad y pentesting.

Conclusión: Desplegar .NET 9 en AKS es una ruta robusta hacia una arquitectura escalable y resiliente. Siguiendo pasos estructurados para contenerización, configuración de clúster y automatización con CI CD puedes reducir la fricción operativa y acelerar la entrega de valor. Si quieres apoyo experto en cualquier fase del proceso, Q2BSTUDIO está listo para acompañarte desde el diseño hasta la operación en producción integrando inteligencia artificial, ciberseguridad y servicios cloud.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.