Kubernetes.First pod

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

beren43

New Member
Nov 25, 2019
13
0
1
Hi,
Hello. I'm starting to learn kubernetes and I came up with a task for myself: to deploy a pod with a standard container from a Docker. The test cluster and the test namespace. Was my plan correct ? :
1) install Docker
2) Download nginx image (docker pull nginx)
3) Create file pod-nginx.yaml
---
apiVersion: v1
kind: Pod
metadata:
name: test-nginx-pod
namespace: dummy
labels:
name: test-nginx-pod
spec:
containers:
- name: nginx
image: nginx:latest
resources:
limits:
memory: "512m"
cpu: "4"
requests:
memory: "256m"
cpu: "2"
ports:
- containerPort: 65342

4) kubectl create -f pod-nginx.yaml

If you do so, the pod will have the status of containercreating.
Does this mean that the pod has been created, but there are no containers in it ?

I do not understand how k8s will understand where to look for an nginx image ?
 

fossxplorer

Active Member
Mar 17, 2016
554
97
28
Oslo, Norway
You dont need to pull images manually like that. Default image registry is Docker Hub, but you can configure others.
Read Images

So in your case, assuming one node/worker, it will use your pulled image.
Status of a healthy pod should be "Running" so something is not right with your pod
Get some more details with "kubectl -n dummy get events" or also try to get the pod name with "kubectl -n dummy get pods" then "kubectl -n dummy describe pods <podname>"