Deploy a Containerized App on OVHcloud Managed Kubernetes
What You'll Learn
- Containerize a simple web app
- Push it to a container registry
- Deploy it to OVHcloud Managed Kubernetes
- Expose it to the internet
Prerequisites
- An OVHcloud account with access to the Public Cloud
- kubectl and helm installed
- Docker installed
- A container registry account (Docker Hub, GitHub Container Registry, or GitLab)
- Basic knowledge of Docker and Kubernetes
Create a Simple Web App (e.g., Python Flask)
# app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Hello from OVHcloud Kubernetes!"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
Dockerize the App
# Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY app.py .
RUN pip install flask
CMD ["python", "app.py"]
Then build and push:
docker build -t yourusername/ovhcloud-k8s-demo:latest .
docker push yourusername/ovhcloud-k8s-demo:latest
Create a Kubernetes Cluster on OVHcloud
- Go to your OVHcloud control panel
- Navigate to “Public Cloud” → “Managed Kubernetes”
- Create a new cluster with at least one node
- Download the kubeconfig file and set it up:
export KUBECONFIG=~/Downloads/your-kubeconfig.yaml
kubectl get nodes
Create Kubernetes Deployment and Service
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: flask-app
spec:
replicas: 2
selector:
matchLabels:
app: flask-app
template:
metadata:
labels:
app: flask-app
spec:
containers:
- name: flask-app
image: yourusername/ovhcloud-k8s-demo:latest
ports:
- containerPort: 5000
---
# service.yaml
apiVersion: v1
kind: Service
metadata:
name: flask-service
spec:
selector:
app: flask-app
ports:
- protocol: TCP
port: 80
targetPort: 5000
type: LoadBalancer
Apply it:
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
Access Your App
Run:
kubectl get svc
Wait for the external IP to appear (LoadBalancer provisioning).
Visit http://your-external-ip and you should see: "Hello from OVHcloud Kubernetes!"