Deploy Kubernetes containers

hello!
i’m using Deploy Kubernetes containers in prcess , and use Default woker pool In Worker Pool section, after run deploy , it’s seem not support kubectl , is there any possible to deploy to k8s without using any custom worker ?

Hi @sky90456,

Thanks for getting in touch!

The Default Worker pool uses a Windows 2016 image that does have Kubectl installed on it.
Full list of tools on the worker image: Dynamic Worker pools - Octopus Deploy

Are you seeing a particular error during your deployment process?

Regards,
Paul

im facing that error…and i dun know how to fix

Leasing WindowsDefault dynamic worker…
April 8th 2021 17:46:24Info
Obtained worker lease successfully.
April 8th 2021 17:46:28Info
Package ‘server’ was not acquired or does not require staging
April 8th 2021 17:47:00Info
Cluster “octocluster” set.
April 8th 2021 17:47:04Info
Context “octocontext” created.
April 8th 2021 17:47:04Info
Switched to context “octocontext”.
April 8th 2021 17:47:04Info
Cluster “octocluster” set.
April 8th 2021 17:47:04Info
Creating kubectl context to https://35.239.82.196 (namespace hello) using Username admin
April 8th 2021 17:47:04Info
User “octouser” set.
April 8th 2021 17:47:04Error
error: no matches for kind “Namespace” in version “v1”
April 8th 2021 17:47:04Error
error: unable to recognize “secret.yml”: no matches for kind “Secret” in version “v1”
April 8th 2021 17:47:08Error
NotSpecified: error: the server doesn’t have a resource type “secret”
April 8th 2021 17:47:08Error
At C:\Octopus\Tentacle\Work\20210408094625-78-8\Script.ps1:99 char:75
April 8th 2021 17:47:08Error

  • … indexOf($))" -value $(& $Kubectl_Exe get secret $ -o=json 2> $null)
    April 8th 2021 17:47:08Error
  •                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    

April 8th 2021 17:47:08Error
at , C:\Octopus\Tentacle\Work\20210408094625-78-8\Script.ps1: line 99
April 8th 2021 17:47:08Error
at Deploy-FeedSecrets, C:\Octopus\Tentacle\Work\20210408094625-78-8\Script.ps1: line 98
April 8th 2021 17:47:08Error
at , C:\Octopus\Tentacle\Work\20210408094625-78-8\Script.ps1: line 566
April 8th 2021 17:47:08Error
at , : line 1
April 8th 2021 17:47:08Error
at , C:\Octopus\Tentacle\Work\20210408094625-78-8\Octopus.KubectlPowershellContext.ps1: line 322
April 8th 2021 17:47:08Error
at , : line 1
April 8th 2021 17:47:08Error
at , C:\Octopus\Tentacle\Work\20210408094625-78-8\Octopus.FunctionAppenderContext.ps1: line 185
April 8th 2021 17:47:08Error
at , C:\Octopus\Tentacle\Work\20210408094625-78-8\Bootstrap.Octopus.FunctionAppenderContext.ps1: line 3116
April 8th 2021 17:47:08Error
at , : line 1
April 8th 2021 17:47:08Error
at , : line 1
April 8th 2021 17:47:08Fatal
The remote script failed with exit code 1
April 8th 2021 17:47:08Fatal
The action Deploy Kubernetes containers on my-first-cluster-1 failed

full log here
error.txt (22.5 KB)

and config

Thanks for the additional log information.

Looking through the log files I can see that kubectl is running fine. The initial error suggests that it is having a problem reaching the configured namespace. The second error may be due to being unable to communicate with the desired namespace too.

If you check your kubernetes target within the Infrastructure > Deployments Targets page and then run a health check from the Connectivity section does this return successfully?
e.g.

updated!

i’m remove namespace and deployment target health check is success.

after redeploy namespace error gone , but still have secret iusse
log.txt (18.6 KB)

plz help , thank you!!

Good to see that health check is now working :slight_smile:

The remaining error looks to be coming from the yaml that you’re attempting to run against the cluster. It seems to be trying access the “secret” resource within the kubernetes target but this resource doesn’t exist.

Are you able to access this resource outside of Octopus? E.g. Kubectl get secret
Are you able to run this yaml against this cluster outside of Octopus?

i can run it !

What is the yaml that you are trying to deploy with this step?

Sorry for late Response!

after couple of hour tring deploy , i change gke version and it’s finally work
GKE version is 1.19.8-gke.1600 having auth issue -> Error from server (Forbidden)

according to
https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication

“Note: Basic authentication is deprecated and has been removed in GKE 1.19 and later.”

now im using GKE 1.16.15-gke.12500 and it’s work

and i have another question
what if i using GKE 1.9 above , how can i config to octupus account ?

We are hoping to add GCP service accounts in the future but we don’t currently have any timescale for this.

I believe other users have had success using client certificates for authentication with GKE. This would be configured within the deployment target rather than as an Account.
e.g.

1 Like