How to update file on kubernetes/docker?

7/8/2019

I am new to Docker/Kubernetes and inherited an application and I am looking to upgrade a JAR file on a pod.

This is the pod:

Name:           app-name-7c7fddfc7c-vthhr
Namespace:      default
Node:           ip-ip-address-goes-here.us-east-2.compute.internal/ip.address.goes.here
Start Time:     Sat, 06 Jul 2019 19:19:37 +0000
Labels:         app=app-name
                pod-template-hash=3739889737
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"app-name-7c7fddfc7c","uid":"d771243c-9992-11e8-ac11-0298f3...
Status:         Running
IP:             other.ip.address.here
Created By:     ReplicaSet/app-name-7c7fddfc7c
Controlled By:  ReplicaSet/app-name-7c7fddfc7c
Containers:
  app-name:
    Container ID:   docker://fefd826441f2d672c3e622727f6f3c26b9ece4e60c624b6dc96de6f8e97e336f
    Image:          remoteserver.com/app-name:1.24.237
    Image ID:       docker-pullable://remoteserver.com/app-name@sha256:5ffc7926e0437f89e7308b09514ec17cf0679fb20dbf97d78b307d7ee4fb13e2
    Port:           8080/TCP
    State:          Running
      Started:      Sat, 06 Jul 2019 19:19:52 +0000
    Ready:          True
    Restart Count:  0
    Limits:
      memory:  1200Mi
    Requests:
      cpu:     200m
      memory:  900Mi
    Environment:
      ...
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-nvwhs (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          True
  PodScheduled   True
Volumes:
  default-token-nvwhs:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-nvwhs
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.alpha.kubernetes.io/notReady:NoExecute for 300s
                 node.alpha.kubernetes.io/unreachable:NoExecute for 300s
Events:          <none>

As far as I can tell, the ReplicaSet is replicating the servers and mounting volumes, which are Amazon snapshots.

Would I just.. upload the file to the pod and due to the fact that it is a mounted volume (my assumption) - it will be updated forever? Am I understanding how this works accurately?

If I am missing any information for anyone who is an expert to know my use-case, I am happy to include it. I just don't completely know what I don't know yet.

-- Cecil Rodriguez
docker
kubernetes

2 Answers

7/10/2019

Based on your comments to the previous answer

even when shutting down a server and starting a new one, the files persist

you are looking for a persistent volumes and probably you want to mount preexisting Persistent Disks as PersistentVolumes

So every time a new pod will be created, you will have a container with mounted volume, containing updated files.

-- A_Suh
Source: StackOverflow

7/8/2019

Pods are ephemeral. You know, "Cattle versus Pets". They're put to slaughter not taken to the vet.

When you want to add new code / new dependancies you build a new Docker image and deploy it to the cluster.

Somewhere in your code / CI pipeline there is a Dockerfile file that defines what / how dependancies are added to the Docker image. Start there, then move on to what ever CI / CD pipeline exists for deploying to the cluster. It may be as unsophisticated as a script calling kubeclt to apply the image to the cluster.

-- MarkOfHall
Source: StackOverflow