Answers: <blockquote>
    <p>my understanding is that I'll probably need to modify the images pulled to do this.</p>
  </blockquote>
  
  <p>Yes and no. It depends on how your <code>ReplicaSet</code> - specifically the associated <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer"><code>Deployment</code></a> - is configured. You can see the corresponding YAML configuration by doing </p>
  
  <pre><code>kubectl -n yournamespace get deployment yourappdeployment -o yaml
  # or 
  kubectl -n yournamespace describe deployment yourappdeployment
  </code></pre>
  
  <p>Which will give you information about environment variables, images used, volumes, secrets, etc. </p>
  
  <blockquote>
    <p>I am trying to pull the images down locally so I can modify them</p>
  </blockquote>
  
  <p>Pulling an image down and modify it in-place won't be of much help, except if you run a container based on this image and use something like <code>docker commit</code> yo actually update the image. Even if you do that, the Kubernetes objects may override aspects defined in your image (such as environment variables)</p>
  
  <blockquote>
    <p>is there a way to see how the ReplicaSet is pulling the images down?</p>
  </blockquote>
  
  <p>Yes, first output the details of your ReplicaSet:</p>
  
  <pre><code>$ kubectl -n yournamespace get replicaset yourreplicaset -o yaml
  
  kind: ReplicaSet
  spec:
    ...
    template:
      ...
      spec:
        ...
        containers:
          ...
        imagePullSecrets:
        - name: some-secret-name
  </code></pre>
  
  <p><code>imagePullSecrets</code> is the secret which should contains the credentials to pull your images. You can retrieve the data with:</p>
  
  <pre><code>$ kubectl -n yournamespace get secret some-secret-name -o yaml
  
  kind: Secret
  ...
  data:
    .dockerconfigjson: eyJh...VeryLongBase64String
  </code></pre>
  
  <p>This is Docker authentication data encoded in Base64. You must decode them:</p>
  
  <pre><code>$ echo "eyJh...VeryLongBase64String" | base64 -d
  
  {"auths": {"registry.yourcompany.com": {"auth": "AnotherBase64EncodedString"}}}
  </code></pre>
  
  <p>Decode the <code>auth</code> value and you'll have your Docker registry login/password</p>
  
  <pre><code>$ echo "AnotherBase64EncodedString" | base64 -d
  
  username:password
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2019-07-17T12:12:54.507Z
Answers: 2019-07-17T12:12:54.507Z
Answers: Pierre B.
Answers: <blockquote>
    <p>I am trying to pull the images down locally so I can modify them</p>
  </blockquote>
  
  <p>Container images are immutable. The correct way to do this is to look for the <code>Dockerfile</code> (if you are using docker as the container engine) that corresponds to the image and make the relevant changes, rebuild the image and push it to the container registry. </p>
  
  <p>The container registry will be evident to you in the Deployment manifest. You are looking for <code>spec.containers.image</code> attribute.  </p>
  
  <p>To answer your question specifically around "is the ReplicaSet pulling a fresh image", this depends on the <code>imagePullPolicy</code> setup in the manifest. You can see the definition below:</p>
  
  <pre><code>
  FIELD:    imagePullPolicy &lt;string&gt;
  
  DESCRIPTION:
       Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always
       if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated.
       More info:
       https://kubernetes.io/docs/concepts/containers/images#updating-images
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2019-07-18T05:33:50.850Z
Answers: 2019-11-02T22:52:12.830Z
Answers: 2019-11-02T22:52:12.830Z
Answers: kaizenCoder
Body: <p>I inherited an app without a ton of handoff information, and there's a Kubernetes setup with ReplicaSets and KOPS (and based on Docker containers). I am pretty new to Kubernetes</p>
  
  <p>Whenever one of the associated servers goes down, a cloned server is immediately spun up, which is working as desired.</p>
  
  <p>However I am looking to make some persistent changes (uploading a some new files to the API, changing some environmental variables) to the setup, and my understanding is that I'll probably need to modify the images pulled to do this. Persistence is setup via PersistentVolumeLabel and openlayer</p>
  
  <p>Is this correct?</p>
  
  <p>I am trying to pull the images down locally so I can modify them, but getting an authentication required error - I have about a dozen private keys, so I assume the credentials are in one of them - is there a way to see how the ReplicaSet is pulling the images down?</p>
  
  <p>Sorry for any confusions - I am very new to Kubernetes and this level of DevOps - I am used to much simpler and less scalable (so like a couple servers and a load balancer) type setups, not this type of DevOps.</p>
  
Tags: <docker><kubernetes>
Title: Is a ReplicaSet pulling a fresh image at every spin up?
UserDisplayName: John Stanzi
ThreadText: # Is a ReplicaSet pulling a fresh image at every spin up?
  
  (Asked by: username_0 on 2019-07-15)
  
  I inherited an app without a ton of handoff information, and there's a Kubernetes setup with ReplicaSets and KOPS (and based on Docker containers). I am pretty new to Kubernetes
  
  Whenever one of the associated servers goes down, a cloned server is immediately spun up, which is working as desired.
  
  However I am looking to make some persistent changes (uploading a some new files to the API, changing some environmental variables) to the setup, and my understanding is that I'll probably need to modify the images pulled to do this. Persistence is setup via PersistentVolumeLabel and openlayer
  
  Is this correct?
  
  I am trying to pull the images down locally so I can modify them, but getting an authentication required error - I have about a dozen private keys, so I assume the credentials are in one of them - is there a way to see how the ReplicaSet is pulling the images down?
  
  Sorry for any confusions - I am very new to Kubernetes and this level of DevOps - I am used to much simpler and less scalable (so like a couple servers and a load balancer) type setups, not this type of DevOps.
  
  **Tags:** docker, kubernetes
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-07-17. Score: 1
  
  > my understanding is that I'll probably need to modify the images pulled to do this.
  
  Yes and no. It depends on how your `ReplicaSet` - specifically the associated [`Deployment`](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) - is configured. You can see the corresponding YAML configuration by doing
  
  ```
  kubectl -n yournamespace get deployment yourappdeployment -o yaml
  # or 
  kubectl -n yournamespace describe deployment yourappdeployment
  
  ```
  
  Which will give you information about environment variables, images used, volumes, secrets, etc.
  
  > I am trying to pull the images down locally so I can modify them
  
  Pulling an image down and modify it in-place won't be of much help, except if you run a container based on this image and use something like `docker commit` yo actually update the image. Even if you do that, the Kubernetes objects may override aspects defined in your image (such as environment variables)
  
  > is there a way to see how the ReplicaSet is pulling the images down?
  
  Yes, first output the details of your ReplicaSet:
  
  ```
  $ kubectl -n yournamespace get replicaset yourreplicaset -o yaml
  
  kind: ReplicaSet
  spec:
    ...
    template:
      ...
      spec:
        ...
        containers:
          ...
        imagePullSecrets:
        - name: some-secret-name
  
  ```
  
  `imagePullSecrets` is the secret which should contains the credentials to pull your images. You can retrieve the data with:
  
  ```
  $ kubectl -n yournamespace get secret some-secret-name -o yaml
  
  kind: Secret
  ...
  data:
    .dockerconfigjson: eyJh...VeryLongBase64String
  
  ```
  
  This is Docker authentication data encoded in Base64. You must decode them:
  
  ```
  $ echo "eyJh...VeryLongBase64String" | base64 -d
  
  {"auths": {"registry.yourcompany.com": {"auth": "AnotherBase64EncodedString"}}}
  
  ```
  
  Decode the `auth` value and you'll have your Docker registry login/password
  
  ```
  $ echo "AnotherBase64EncodedString" | base64 -d
  
  username:password
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2019-07-18. Score: 1
  
  > I am trying to pull the images down locally so I can modify them
  
  Container images are immutable. The correct way to do this is to look for the `Dockerfile` (if you are using docker as the container engine) that corresponds to the image and make the relevant changes, rebuild the image and push it to the container registry.
  
  The container registry will be evident to you in the Deployment manifest. You are looking for `spec.containers.image` attribute.
  
  To answer your question specifically around "is the ReplicaSet pulling a fresh image", this depends on the `imagePullPolicy` setup in the manifest. You can see the definition below:
  
  ```
  
  FIELD:    imagePullPolicy <string>
  
  DESCRIPTION:
       Image pull policy. One of Always, Never, IfNotPresent. Defaults to Always
       if :latest tag is specified, or IfNotPresent otherwise. Cannot be updated.
       More info:
       https://kubernetes.io/docs/concepts/containers/images#updating-images
  
  ```
  
  
  ---
  
  