K8S集群内部 无持久化Redis单节点配置文件
apiVersion: apps/v1 kind: Deployment metadata: name: redis-deploy spec: selector: matchLabels: prod: redis replicas: 1 template: metadata: labels: prod: redis spec: containers: - name: prod-redis ports: - containerPort: 6379 image: redis --- apiVersion: v1 kind: Service metadata: name: redis-service spec: type: NodePort ports: - port: 6379 # 容器端口 nodePort: 26379 # 对外暴露端口 selector: prod: redis