Deploy a redis pod using the redis:alpine image with the labels set to tier=db
Run the command to generate the definition file:
$kubectl run redis --image=redis:alpine --dry-run=client -oyaml > redis-pod.yaml --- apiVersion: v1 kind: Pod metadata: labels: tier: db name: redis spec: containers: - image: redis:alpine name: redis dnsPolicy: ClusterFirst restartPolicy: Always
Then run the command: kubectl create -f redis-pod.yaml
to create the pod from the definition file.
OR Use the imperative command: –
$kubectl run redis -l tier=db --image=redis:alpine