'Deploy docker image from dockerhub to kubenetes

Can anny one suggest how to deploy docker image from public repository to kubernestes using yaml?

I have no idea, but need to deply the docker image in kubernestes cluster.



Solution 1:[1]

If you use a deployment, statefulset, daemonset, pod ect. the image: nginx:1.14.2 will check the docker hub to pull the docker image. If you use another public repository for example the google docker repository just add the hostname like this image: gcr.io/google-containers/busybox:latest. Most of the time there is a pull command button that shows you the full docker image name with the tag. Like here.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nagyzekkyandras