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