cd posts docker build -t rayalevinson/posts:0.0.1 .
Result: docker.io/rayalevinson/posts:0.0.1
infra --> k8s --> posts.yaml
apiVersion: v1 kind: Pod metadata: name: posts spec: containers: - name: posts image: docker.io/rayalevinson/posts:0.0.1
apiVersion: v1 <-- K8s is extensible - we may add in our own custom objects kind: Pod <-- the type of object we want to create metadata: <-- config options for the object we are about to create name: posts <-- when the pod is created, give it a name of "posts" spec: <-- The exact attributes we want to apply to the object we are about to create containers: <-- An array. We can create many containers in a single pod - name: posts <-- An array entity. One array entry. Make a container with a name of 'posts' image: docker.io/rayalevinson/posts:0.0.1 <-- The exact image we want to use
By default if version is not specified, docker adds :latest as version.
If version is not specified or :latest is specified, k8s will reach out the Docker Hub and will try to find and image listed in Docker Hub.
When version like 0.0.1 is specified, k8s will search for the image on the local machine first.
Run the yaml file cd .. cd infra/k8s kubectl apply -f posts.yaml
Result: pod/posts created