Deploying Spring Boot to Kubernetes
EK, Spring, Boot, microservice, ke, liye, Kubernetes, Deployment, manifest, (YAML) ke, saath, REPLICAS, IMAGE, aur, RESOURCE, LIMITS, DEFINE, kiye, jaate, HAIN — Service, manifest, se, EK, STABLE, NETWORK, ADDRESS, milta, hai.
Spring, Boot, application.yml, mein, ENVIRONMENT-SPECIFIC, VALUES, ko, Kubernetes, ConfigMaps, aur, Secrets, se, INJECT, kiya, ja, sakta hai — CODE, mein, HARDCODE, kiye, BINA.
apiVersion: apps/v1
kind: Deployment
metadata: { name: order-service }
spec:
replicas: 3
template:
spec:
containers:
- name: order-service
image: order-service:1.0
envFrom:
- configMapRef: { name: order-service-config }
livenessProbe:
httpGet: { path: /actuator/health/liveness, port: 8080 }- Deployment manifest = replicas, image, resource, limits, define, karta, hai
- ConfigMaps/Secrets, se, environment-specific, values, INJECT, hoti, hain
- livenessProbe, Actuator, ke, /actuator/health/liveness, endpoint, se, DIRECTLY, map, hota, hai
Kubernetes, Deployment, mein, resources.requests, (guaranteed, minimum) aur, resources.limits, (maximum, allowed) SET, karna, IMPORTANT, hai — Spring, Boot, applications, ke, liye, typically, memory, limits, JVM, heap, size, se, ZYAADA, hona, CHAHIYE (metaspace, thread, stacks, ke, liye).
resources:
requests: { memory: "512Mi", cpu: "250m" }
limits: { memory: "1Gi", cpu: "500m" }spring-cloud-starter-kubernetes-all, dependency, se, Spring, Boot, applications, Kubernetes-NATIVE, features, (ConfigMaps, discovery) ko, Spring's, familiar, APIs, (jaise, @Value, @ConfigurationProperties) ke, saath, USE, kar, sakte, hain, Kubernetes-specific, CODE, likhe, bina.