1、redis-rc文件内容如下:

cat redis-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
  name: redis
spec:
   replicas: 1
   selector:
     app: redis
   template:
     metadata:
       labels:
         app: redis
     spec:
       containers:
       - name: redis
         image: redis
         resources:
           requests:
             cpu: 100m              #限制cpu的数量为0.1个
             memory: 100Mi      #限制内存为100M
         ports:
         - containerPort: 6379

2、redis-svc内容如下:

cat redis-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: redis
spec:
  type: NodePort
  ports:
   - port: 6379
     nodePort: 30003
  selector:
    app: redis
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐