Get the file (pod.yml)
apiVersion: v1
kind: Pod
metadata:
name: first-app
labels:
app: nodeapp
spec:
containers:
- name: nodeapp
image: kammana/nodeapp:v1
ports:
- containerPort: 8080
$ kubectl create -f https://raw.githubusercontent.com/javahometech/kubernetes/master/pods/pods.yml
$ kubectl get pods
Syntax - kubectl describe pods/POD_NAME
$ kubectl describe pods/nodeapp
Syntax - kubectl exec POD_NAME CMD_TO_EXECUTE
$ kubectl exec nodeapp printenv
Syntax - kubectl exec -it POD_NAME bash
$ kubectl exec -it nodeapp bash
Syntax - kubectl logs POD_NAME
$ kubectl logs nodeapp
By default Pods run in a isolated environment i.e. they are reachable within kubernetes cluster, if you wanna reach your pod outside cluster, You have to expose it
$ kubectl expose pods/nodeapp --type="NodePort" --port 8080