kubernetes-simple yaml file for nginx deployment!
kubernetes

kubernetes-simple yaml file for nginx deployment!

apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

this is a sample for deployment concept!

apiVersion: its a api created by kubernetes for update in future and last version of api was v1

kind: in kubernetes all object is a kind like pod repicationcontroller,services,....

metadata:its a section that we can choice a name for our kind and we labels our kind!on this yaml example we have a deployment kind and on the section of spec we have labels

spec: selector and labels is like key and locking they just match together maybe we have so many pod or so many service they can know each other with label and selector

repilcaset:its a new version of replication controller and its mean how many pod we need to be run(if one of pod is fails soon replace by another pod)

template:its a pattern for run pod in this yaml file

containers:name of your container want to deploy

image:name of images in your or docker hub repository

ports:expose port 80 for your container in cluster

要查看或添加评论,请登录

Behnam Hasanbeygi的更多文章

  • jenkins-installing on docker!

    jenkins-installing on docker!

    hello!i am behnam hasanbeygi im working for a it company which our goals is VAS(value added service).on this article i…

社区洞察

其他会员也浏览了