0%
الإدارة والتنسيق باستخدام Kubernetes

Kubernetes

الإدارة والتنسيق باستخدام Kubernetes

10-15 دقيقة

الإدارة والتنسيق باستخدام Kubernetes

يُعدّ Kubernetes الحل القياسي لتنسيق الحاويات (Orchestration). سنرى في هذا الدرس كيفية نشر خدماتنا المصغّرة وإدارتها على عنقود Kubernetes (Cluster).

1. الإعداد الأساسي

1.1 نشر الخدمات

# 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

التعليقات

التعليقات مدعومة عبر GitHub Discussions

سجّل الدخول باستخدام GitHub للمشاركة في النقاش

تم نسخ الرابط!