Deploying a Docker Image for Kubernetes

I've been working with Docker lately and I've created a basic Docker image with a Dockerfile. It just starts the web server. Now I read on and created an account with Google Application Engine and want to deploy this image to Kubernetes.

I feel lost.

I don't understand how my Dockerfiles that I have can be ported to this platform? Don't I use them at all? I've seen a few examples of Pod configuration, but as far as I can see they are linking to images in Docker Hub?

Can anyone point me in the right direction on what to do?

+3


source to share


3 answers


I have not worked with Kubernetes, but as far as I know, I think you should be uploading to containers in the docker image repository. You can use the official hub and upload your images there (public images are free to download, and you can have one private for free or pay for additional ones). You can also have a private docker image repository and configure kubernetes to use it.



As I understand from this post , you can run the Google Cloud bucket link with local docker store and then configure the kubernetes module to point to that bucket and all other pods can consume docker images.

+1


source


First of all, I lost it a bit myself, although I was able to create a basic working php script running on a docker image on a Google Cloud Engine vm instance inside a container cluster. Where documents are easier

A container container is a group of Compute Engine instances launched by Kubernete ...

So, in answer to the question

See the following GitHub repository https://github.com/CrandellWS/Kubernetes-Php-Example

There are minimal files and source. You will find Dockerfile in the root and one php page in the src folder.



Auto build was set for this via docker and can be found at https://registry.hub.docker.com/u/crandellws/kubernetes-php-example/

Replicating this will be done by marking up the GitHub repository and setting up your auto build: http://docs.docker.com/docker-hub/builds/

Once that is done, you can pull the docker image into your Kubernetes setup and run it. For example the following shows with the specified Dockerfile:

sudo docker pull crandellws/kubernetes-php-example
sudo docker run -p 80:80 -it -d --name csupport crandellws/kubernetes-php-example

      

https://cloud.google.com/container-engine/docs/

0


source


To pull an image from a private GKE repository, we need to create a docker-registry secret for authentication.

kubectl create secret docker-registry regcred --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email>

      

Include the imagePullSecrets tag in your yaml file as shown below and you can pull the image from the specified repository.

apiVersion: v1
kind: Pod
metadata:
    name: pull-demo
spec:
    containers:
    - name: pull-demo-container
      image: nginx
    imagePullSecrets:
    - name: regsecret  

      

0


source







All Articles