Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleExample: nginx pulled from registry
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: DeploymentPod
metadata:
  name: nginx-jmehan
spec:
  selector:
    matchLabels:
      app: nginx-jmehan
  replicas: 1 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      sample
  labels:
        app: nginx-jmehan
    sample
spec:
      containers:
      - name: nginx-jmehan
    sample
    image: localhost:30500/nginx-jmehan:latest
        ports:
        - containerPort: 80
      imagePullSecrets:
      - name: regcred
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-jmehan
spec:
  type: NodePort
  selector:
    app: nginx-jmehan
  ports:
    - port: 80
      nodePort: 31081
      name: nginx-jmehan


Test that you can pull from the cluster registry

...


Configure a node that uses the new image

vi nginx-jmehansample.yml


Code Block
titleExample: nginx pulled from registrysample.yml
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: DeploymentPod
metadata:
  name: nginx-jmehan
spec:
  selector:
    matchLabels:
      app: nginx-jmehan
  replicas: 1 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
   sample
  labels:
     app: nginx-jmehan
    sample
spec:
      containers:
      - name: nginx-jmehan
    sample
    image: localhost:30500/nginx-jmehan:latest
        ports:
        - containerPort: 80
      imagePullSecrets:
      - name: regcred
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-jmehansample
spec:
  type: NodePort
  selector:
    app: nginx-jmehansample
  ports:
    - port: 80
      nodePort: 3108130080
      name: nginx-jmehansample

kubectl apply -f nginx-jmehanf sample.yml


Navigate to http://localhost:31081/ to see our new pod.

...