Azure DevOps pipeline kubectl task command: rollout unavailable
Asked Answered
S

2

6

Hi I am trying to implement the rollback for Kubernetes deployments using this guide, https://adrianbumbas.com/rollback-kubernetes-deployments-with-azure-devops-pipelines/. However, when adding a new kubectl task into the pipeline, I was unable to find the rollout command. I would like to know if there can be other alternative ways that I can achieve it. I appreciate the sharing of knowledge if you have previously encountered similar issue.

enter image description here

Silverside answered 8/10, 2020 at 18:41 Comment(2)
What Kubernetes version do you have in aks? in the documentation says, kubectl rollout is available in Kubernetes server version 1.7 or later.Boxberry
@Boxberry my kubernetes version is 1.7.11Silverside
Y
3

As suggested here already, you can use rollout as you would any other command, the below worked perfectly for me

- stage: Deploy_BVT
  displayName: Deploy BVT
  dependsOn: Build
  jobs:
  - deployment: Deploy_BVT
    pool:
      vmImage: $(vmImageName)
    environment: '$(envName).my_namespace'

...

- task: Kubernetes@1
  inputs:
  connectionType: 'Kubernetes Service Connection'
  namespace: 'my_namespace'
  command: 'rollout'
  arguments: 'restart deploy my_deployment'
Yellowknife answered 29/3, 2022 at 22:50 Comment(0)
L
2

You got this warning was because kubectl task command had a dropdowm list containing the following kubectl commands:

apply, create, delete, exec, expose, get, login, logout, logs, run, set, or top

From my test, even you got this warning, you still could run the pipeline, and pipeline could recognize rollout command. You may have a try.

Lancaster answered 9/10, 2020 at 4:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.