K8s installs Redis standalone
Create a yaml
Cat <<EOF> /root/k3s_yaml/redis_nfs/redis-nfs.yaml # create PV -- apiVersion: v1 kind: PersistentVolume metadata: name: redis-nfs-pv namespace: default spec: capacity: storage: 1Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain storageClassName: nfs-redis nfs: path: /root/data/ NFS /redis server: 192.168.72.100 # create type: PersistentVolumeClaim apiVersion: v1 metadata: name: redis-nfs-pvc namespace: default spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi storageClassName: ApiVersion: apps/v1 kind: Deployment metadata: name: redis namespace: default spec: replicas: 1 selector: matchLabels: app: redis template: metadata: labels: app: redis spec: containers: - name: redis image: Redis :5.0 volumeMounts: -name: redis-nfs mountPath: "/data" command: - "redis-server" volumes: -name: Redis-persistentvolumeclaim: claimName: redis-persistentVolumeclaim: claimName: redis-nfs-PVC redis-nfs namespace: default spec: type: NodePort ports: - port: 6379 protocol: TCP targetPort: 6379 name: http nodePort: 30079 selector: app: redis EOFCopy the code
The installation
kubectl apply -f /root/k3s_yaml/redis_nfs/redis-nfs.yaml
Copy the code
Kubernetes Cluster deployment Redis5.0.6 standalone