This scenario shows:
- how to create basic K8s pod using yaml file,
- how to get more information about pod (to solve troubleshooting),
-
Run minikube (in this scenario, K8s runs on WSL2- Ubuntu 20.04) ("minikube start")
-
Create Yaml file (pod1.yaml) in your directory and copy the below definition into the file:
apiVersion: v1
kind: Pod # type of K8s object: Pod
metadata:
name: firstpod # name of pod
labels:
app: frontend # label pod with "app:frontend"
spec:
containers:
- name: nginx
image: nginx:latest # image name:image version, nginx downloads from DockerHub
ports:
- containerPort: 80 # open ports in the container
env: # environment variables
- name: USER
value: "username"