Skip to content

Instantly share code, notes, and snippets.

@JeffHenson
Last active April 10, 2019 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffHenson/d4efd995f0ad7aa8e6b119920084bc90 to your computer and use it in GitHub Desktop.
Save JeffHenson/d4efd995f0ad7aa8e6b119920084bc90 to your computer and use it in GitHub Desktop.
kind: CronJob
apiVersion: batch/v1beta1
metadata:
name: test-cron-job
spec:
jobTemplate:
spec:
template:
spec:
containers:
- image: busybox:latest
imagePullPolicy: Always
name: test-job
args:
- /bin/sh
- -c
- date; echo Hello from the Kubernetes cluster
restartPolicy: Never
schedule: "*/1 * * * *"
successfulJobsHistoryLimit: 5
failedJobsHistoryLimit: 5
concurrencyPolicy: Forbid
{
"apiVersion": "batch/v1beta1",
"kind": "CronJob",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"batch/v1beta1\",\"kind\":\"CronJob\",\"metadata\":{\"annotations\":{},\"name\":\"test-cron-job\",\"namespace\":\"devops-ops\"},\"spec\":{\"concurrencyPolicy\":\"Forbid\",\"failedJobsHistoryLimit\":5,\"jobTemplate\":{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"args\":[\"/bin/sh\",\"-c\",\"date; echo Hello from the Kubernetes cluster\"],\"image\":\"busybox:latest\",\"imagePullPolicy\":\"Always\",\"name\":\"test-job\"}],\"restartPolicy\":\"Never\"}}}},\"schedule\":\"*/1 * * * *\",\"successfulJobsHistoryLimit\":5}}\n"
},
"creationTimestamp": "2019-04-10T01:30:33Z",
"name": "test-cron-job",
"namespace": "devops-ops",
"resourceVersion": "158679998",
"selfLink": "/apis/batch/v1beta1/namespaces/devops-ops/cronjobs/test-cron-job",
"uid": "3becda61-5b30-11e9-be87-005056ab4b6f"
},
"spec": {
"concurrencyPolicy": "Forbid",
"failedJobsHistoryLimit": 5,
"jobTemplate": {
"metadata": {
"creationTimestamp": null
},
"spec": {
"template": {
"metadata": {
"creationTimestamp": null
},
"spec": {
"containers": [
{
"args": [
"/bin/sh",
"-c",
"date; echo Hello from the Kubernetes cluster"
],
"image": "busybox:latest",
"imagePullPolicy": "Always",
"name": "test-job",
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File"
}
],
"dnsPolicy": "ClusterFirst",
"restartPolicy": "Never",
"schedulerName": "default-scheduler",
"securityContext": {},
"terminationGracePeriodSeconds": 30
}
}
}
},
"schedule": "*/1 * * * *",
"successfulJobsHistoryLimit": 5,
"suspend": false
},
"status": {}
}
Task ID: ServerTasks-87649
Related IDs: Deployments-32313, Channels-1252, Releases-21306, Projects-930, Spaces-1, Environments-41
Task status: Failed
Task queued: Tuesday, 09 April 2019 8:23:30 PM -05:00
Task started: Tuesday, 09 April 2019 8:23:30 PM -05:00
Task completed: Tuesday, 09 April 2019 8:23:36 PM -05:00
Task duration: 5 seconds
Server version: 2019.3.0+Branch.tags-2019.3.0.Sha.766cff30a6097aec53e5a8bb9658048b0d51dc93
Server node: EHOPSOCTO01
| == Failed: Deploy CronJobTest release 0.0.1 to OPS ==
20:23:31 Verbose | Guided failure is not enabled for this task
20:23:36 Fatal | The deployment failed because one or more steps failed. Please see the deployment log for details.
|
| == Failed: Step 1: CronJob ==
20:23:35 Fatal | The step failed: Activity CronJob on k8s-devops-ops-br1d1 failed with error 'The remote script failed with exit code 1'.
20:23:35 Verbose | CronJob completed
|
| Failed: k8s-devops-ops-br1d1
20:23:31 Verbose | Octopus Server version: 2019.3.0+Branch.tags-2019.3.0.Sha.766cff30a6097aec53e5a8bb9658048b0d51dc93
20:23:31 Verbose | Environment Information:
| OperatingSystem: Microsoft Windows NT 6.3.9600.0
| OsBitVersion: x64
| Is64BitProcess: True
| CurrentUser: NT AUTHORITY\SYSTEM
| MachineName: EHOPSOCTO01
| ProcessorCount: 2
| CurrentDirectory: C:\Windows\system32
| TempDirectory: C:\Windows\TEMP\
| HostProcessName: Octopus.Server
| PID: 17240
20:23:31 Verbose | Executing CronJob (type Deploy raw Kubernetes YAML) on Octopus Server
20:23:31 Verbose | Using Calamari 4.15.2
20:23:31 Verbose | Running this script in the Octopus Server security context (NT AUTHORITY\SYSTEM)
20:23:31 Verbose | Starting C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in working directory 'C:\Octopus\Work\20190410012331-87649-312' using 'OEM United States' encoding running as 'NT AUTHORITY\SYSTEM' with the same environment variables as the launching process
20:23:32 Verbose | Octopus Deploy: Calamari version 4.15.2
20:23:32 Verbose | Environment Information:
20:23:32 Verbose | OperatingSystem: Microsoft Windows NT 6.3.9600.0
20:23:32 Verbose | OsBitVersion: x64
20:23:32 Verbose | Is64BitProcess: True
20:23:32 Verbose | CurrentUser: NT AUTHORITY\SYSTEM
20:23:32 Verbose | MachineName: EHOPSOCTO01
20:23:32 Verbose | ProcessorCount: 2
20:23:32 Verbose | CurrentDirectory: C:\Octopus\Work\20190410012331-87649-312
20:23:32 Verbose | TempDirectory: C:\Windows\TEMP\
20:23:32 Verbose | HostProcessName: Calamari
20:23:32 Verbose | Performing variable substitution on 'C:\Octopus\Work\20190410012331-87649-312\Script.ps1'
20:23:33 Verbose | Parsing file 'C:\Octopus\Work\20190410012331-87649-312\Script.ps1' with Octostache returned the following error: `The following tokens were unable to be evaluated: '#{Octopus.Action.KubernetesContainers.DeploymentStyle}', '#{Octopus.Action.KubernetesContainers.DeploymentWait}', '#{Octopus.Action.KubernetesContainers.SecretNames}', '#{Octopus.Action.KubernetesContainers.ComputedConfigMapName}', '#{Octopus.Action.KubernetesContainers.ComputedSecretName}', '#{Octopus.Action.KubernetesContainers.ComputedDeploymentName}', '#{Octopus.Action.KubernetesContainers.ServiceName}', '#{Octopus.Action.KubernetesContainers.IngressName}'`
20:23:33 Verbose | Performing variable substitution on 'C:\Octopus\Work\20190410012331-87649-312\customresource.yml'
20:23:33 Verbose | Executing 'C:\Octopus\Work\20190410012331-87649-312\Script.ps1'
20:23:33 Verbose | Name Value
20:23:33 Verbose | ---- -----
20:23:33 Verbose | PSVersion 5.0.10586.117
20:23:33 Verbose | PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
20:23:33 Verbose | BuildVersion 10.0.10586.117
20:23:33 Verbose | CLRVersion 4.0.30319.42000
20:23:33 Verbose | WSManStackVersion 3.0
20:23:33 Verbose | PSRemotingProtocolVersion 2.3
20:23:33 Verbose | SerializationVersion 1.1.0.1
20:23:34 Verbose | PowerShell Environment Information:
20:23:34 Verbose | OperatingSystem: Microsoft Windows NT 6.3.9600.0
20:23:34 Verbose | OsBitVersion: x64
20:23:34 Verbose | Is64BitProcess: True
20:23:34 Verbose | CurrentUser: NT AUTHORITY\SYSTEM
20:23:34 Verbose | MachineName: EHOPSOCTO01
20:23:34 Verbose | ProcessorCount: 2
20:23:34 Verbose | CurrentDirectory: C:\Octopus\Work\20190410012331-87649-312
20:23:34 Verbose | CurrentLocation: C:\Octopus\Work\20190410012331-87649-312
20:23:34 Verbose | TempDirectory: C:\Windows\TEMP\
20:23:34 Verbose | HostProcessName: powershell
20:23:34 Verbose | TotalPhysicalMemory: 8387524 KB
20:23:34 Verbose | AvailablePhysicalMemory: 4933596 KB
20:23:34 Verbose | Temporary kubectl config set to C:\Octopus\Work\20190410012331-87649-312\kubectl-octo.yml
20:23:34 Verbose | Cluster "octocluster" set.
20:23:34 Verbose | Context "octocontext" created.
20:23:34 Verbose | Switched to context "octocontext".
20:23:34 Verbose | Property "clusters.octocluster.certificate-authority-data" set.
20:23:34 Verbose | Creating kubectl context to https://console.br1d1-paas.local.domain (namespace devops-ops) using a Token
20:23:35 Verbose | User "octouser" set.
20:23:35 Verbose | apiVersion: v1
20:23:35 Verbose | clusters:
20:23:35 Verbose | - cluster:
20:23:35 Verbose | server: https://console.br1d1-paas.local.domain
20:23:35 Verbose | name: octocluster
20:23:35 Verbose | contexts:
20:23:35 Verbose | - context:
20:23:35 Verbose | cluster: octocluster
20:23:35 Verbose | namespace: devops-ops
20:23:35 Verbose | user: octouser
20:23:35 Verbose | name: octocontext
20:23:35 Verbose | current-context: octocontext
20:23:35 Verbose | kind: Config
20:23:35 Verbose | preferences: {}
20:23:35 Verbose | users:
20:23:35 Verbose | - name: octouser
20:23:35 Verbose | user:
20:23:35 Verbose | token: ********
20:23:35 Verbose | Invoking target script C:\Octopus\Work\20190410012331-87649-312\Script.ps1 with parameters
20:23:35 Verbose | ---
20:23:35 Verbose | "kind": "CronJob"
20:23:35 Verbose | "apiVersion": "batch/v1beta1"
20:23:35 Verbose | "metadata":
20:23:35 Verbose | "name": "test-cron-job"
20:23:35 Verbose | "labels":
20:23:35 Verbose | "Octopus.Kubernetes.SelectionStrategyVersion": "SelectionStrategyVersion2"
20:23:35 Verbose | "Octopus.Project.Id": "projects-930"
20:23:35 Verbose | "Octopus.Action.Id": "02aa0644-b670-4adc-8132-b99261ac93c3"
20:23:35 Verbose | "Octopus.Deployment.Id": "deployments-32313"
20:23:35 Verbose | "Octopus.Step.Id": "a623062d-05ee-46d2-a61f-cce795d9f1cc"
20:23:35 Verbose | "Octopus.Environment.Id": "environments-41"
20:23:35 Verbose | "Octopus.Deployment.Tenant.Id": "untenanted"
20:23:35 Verbose | "spec":
20:23:35 Verbose | "jobTemplate":
20:23:35 Verbose | "spec":
20:23:35 Verbose | "template":
20:23:35 Verbose | "spec":
20:23:35 Verbose | "containers":
20:23:35 Verbose | - "image": "busybox:latest"
20:23:35 Verbose | "imagePullPolicy": "Always"
20:23:35 Verbose | "name": "test-job"
20:23:35 Verbose | "args":
20:23:35 Verbose | - "/bin/sh"
20:23:35 Verbose | - "-c"
20:23:35 Verbose | - "date; echo Hello from the Kubernetes cluster"
20:23:35 Verbose | "restartPolicy": "Never"
20:23:35 Verbose | "schedule": "*/1 * * * *"
20:23:35 Verbose | "successfulJobsHistoryLimit": 5
20:23:35 Verbose | "failedJobsHistoryLimit": 5
20:23:35 Verbose | "concurrencyPolicy": "Forbid"
20:23:35 Error | "kubectl apply -o json" returned invalid JSON. This can happen with older versions of kubectl. Please update to a recent version of kubectl.
20:23:35 Error | See https://github.com/kubernetes/kubernetes/issues/58834 for more details.
20:23:35 Error | Custom resources will not be saved as output variables, and will not be automatically cleaned up.
20:23:35 Error | The previous custom resources were not removed.
20:23:35 Error | The deployment process failed. The resources created by this step will be passed to "kubectl describe" and logged below.
20:23:35 Verbose | Process C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in C:\Octopus\Work\20190410012331-87649-312 exited with code 1
20:23:35 Verbose | Updating manifest with output variables
20:23:35 Verbose | Updating manifest with action evaluated variables
20:23:35 Fatal | The remote script failed with exit code 1
20:23:35 Fatal | The action CronJob on k8s-devops-ops-br1d1 failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment