Upgrade Kubernetes Deployment

Agent Versions

Always match the agent version to Portainer Server version. i.e., while installing or upgrading to Portainer 2.6 make sure all the agents are also version 2.6.

Steps to upgrade Portainer and or Portainer agent deployed into Kubernetes. Upgrade method depends on the original install method used.

Using Helm

Add Portainer helm repo running the following, ignore any warning about the repo being there already.

helm repo add portainer https://portainer.github.io/k8s/
helm repo update

Run the command below to upgrade to latest version of Portainer

helm upgrade -n portainer portainer portainer/portainer --reuse-values

Using YAML Manifest

Method 1:

Easiest way to upgrade is to use Portainer UI and use manifest files..

Copy the contents of manifest file from

For NodePort

https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer.yaml
Agent Only
https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/agent/portainer-agent-k8s-nodeport.yaml

For LoadBalancer

https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer-lb.yaml
Agent Only
https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/agent/portainer-agent-k8s-lb.yaml

Login to portainer, in Kubernetes endpoint where portainer is installed go to Applications --> Advanced Deployment. Paste the yaml content.

alt Manifest Deployment

Paste the yaml content and click Deploy. Portainer should come back to a login page in a few seconds.

alt Manifest Deployment

Method 2:

For NodePort

kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer.yaml
Agent Only
kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/agent/portainer-agent-k8s-nodeport.yaml

For Load Balancer

kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer-lb.yaml
Agent Only
kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/agent/portainer-agent-k8s-lb.yaml

Now you can go to portainer url and login. You should notice the new version number at the bottom left of Portainer UI.

Force Update

If portainer does not update after running the above commands, force the download of latest image by running the following:

kubectl -n portainer rollout restart deployment.apps/portainer

or for Agent Only

kubectl -n portainer rollout restart deployment.apps/portainer-agent

Notes

Contribute to these docs