0%
Orchestration with Kubernetes

Kubernetes

Orchestration with Kubernetes

10-15 min

Orchestration with Kubernetes

Kubernetes is the standard solution for container orchestration. We will see how to deploy and manage our microservices on a Kubernetes cluster.

1. Basic Configuration

1.1 Deploying Services

# product-service-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: product-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: product-service
  template:
    metadata:
      labels:
        app: product-service
    spec:
      containers:
      - name: product-service
        image: product-service:latest
        ports:
        - containerPort: 8081
        env:
        - name: SPRING_PROFILES_ACTIVE
          value: "prod"
        - name: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE
          value: "http://eureka-server:8761/eureka/"
        - name: SPRING_CLOUD_CONFIG_URI
          value: "http://config-server:8888"
        resources:
          requests:
            memory: "512Mi"
            cpu: "200m"
          limits:
            memory: "1Gi"
            cpu: "500m"
        readinessProbe:
          httpGet:
            path: /actuator/health
            port: 8081
          initialDelaySeconds: 30
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /actuator/health
            port: 8081
          initialDelaySeconds: 60
          periodSeconds: 20

Comments

Comments are powered by GitHub Discussions

Sign in with GitHub to join the discussion

Link copied!