hashicorp / hashicorp/nomad

Forcing a placement with failed deployment

Open
#3,093 14 comments 1 reaction 0 assignees View on GitHub
hcc/jira stage/needs-discussion theme/deployments
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version

Nomad v0.6.0

### Operating system and Environment details

Ubuntu Xenial running in LXD

### Issue

So this is a bit more obscure than I initially thought.

We had a bit of a rough time (hilariously, consul running an LXD container hanging up a whole metal server) and I had to kill off a node in the middle of a deployment because it just hang while supposedly downloading a docker container.

At this point it had already placed an alloc on another node however I can't make it to re-try to place the second one again. Both nomad run and nomad plan just pretend like everything is fine.

I was able to fill up clients that we lost during an outage tonight so it seems to be specific to the failed deployment?

I could only fix it by forcing a change in the plan (I just rebuilt the container).

#### Nomad Status

``` shell
$ nomad status enduser
ID = enduser
Name = enduser
Submit Date = 08/23/17 21:28:51 CEST
Type = service
Priority = 50
Datacenters = scaleup
Status = running
Periodic = false
Parameterized = false

Summary
Task Group Queued Starting Running Failed Complete Lost
enduser 0 0 1 0 2 1

Latest Deployment
ID = 6f7b3785
Status = failed
Description = Failed due to unhealthy allocations

Deployed
Task Group Desired Placed Healthy Unhealthy
enduser 2 2 1 1

Allocations
ID Node ID Task Group Version Desired Status Created At
6c01a752 b77a68ed enduser 3 stop lost 08/24/17 10:11:16 CEST
e2693daa 60101861 enduser 3 run running 08/24/17 10:11:16 CEST
db58bf99 c7caeb6b enduser 3 run complete 08/24/17 05:14:15 CEST
2f2c1d45 c7caeb6b enduser 3 run complete 08/23/17 21:28:52 CEST
```

#### Nomad plan

``` shell
Job: "enduser"
Task Group: "enduser" (1 ignore)
Task: "enduser"

Scheduler dry-run:
- All tasks successfully allocated.

Job Modify Index: 858133
To submit the job with version verification run:

nomad run -check-index 858133 _enduser.hcl

When running the job with the check-index flag, the job will only be run if the
server side version matches the job modify index returned. If the index has
changed, another user has modified the job and the plan's results are
potentially invalid.
```

#### Nomad run

``` shell
$ nomad run _enduser.hcl
==> Monitoring evaluation "788e8161"
Evaluation triggered by job "enduser"
Evaluation within deployment: "6f7b3785"
Evaluation status changed: "pending" -> "complete"
==> Evaluation "788e8161" finished with status "complete"
```

#### Nomad alloc-status for the broken alloc

``` shell
$ nomad alloc-status 6c01a752
ID = 6c01a752
Eval ID = bf04b0f5
Name = enduser.enduser[1]
Node ID = b77a68ed
Job ID = enduser
Job Version = 3
Client Status = failed
Client Description =
Desired Status = stop
Desired Description = alloc is lost since its node is down
Created At = 08/24/17 10:11:16 CEST
Deployment ID = 6f7b3785
Deployment Health = unhealthy

Task "enduser" is "dead"
Task Resources
CPU Memory Disk IOPS Addresses
500 MHz 128 MiB 300 MiB 0 http: 10.6.32.3:29213

Task Events:
Started At = N/A
Finished At = N/A
Total Restarts = 0
Last Restart = N/A

Recent Events:
Time Type Description
08/24/17 10:56:55 CEST Killing Killing task: vault: failed to derive token: Can't request Vault token for terminal allocation
08/24/17 10:16:17 CEST Driver Downloading image docker.XXX/enduser:1136
08/24/17 10:11:17 CEST Task Setup Building Task Directory
08/24/17 10:11:17 CEST Received Task received by client
```

#### Nomad eval-status

``` shell
nomad eval-status 788e8161
ID = 788e8161
Status = complete
Status Description = complete
Type = service
TriggeredBy = job-register
Job ID = enduser
Priority = 50
Placement Failures = false
```

### Job file (if appropriate)

```
job "enduser" {
datacenters = ["scaleup"]

update {
max_parallel = 1
}

group "enduser" {
count = 2

task "enduser" {
driver = "docker"

config {
image = "https://docker.XXX/enduser:1136"
port_map = {
http = 8000
}
}

env {
APP_ENV = "prod"
}

service {
name = "enduser"
port = "http"
tags = [
"env-prod",
]

check {
type = "http"
protocol = "https"
path = "/mail/"
interval = "10s"
timeout = "2s"
}
}

resources {
cpu = 500
memory = 128

network {
mbits = 10

port "http" {}
}
}

vault {
policies = ["enduser-prod"]
}
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the recorded nomad status, plan, run, alloc-status, and eval-status outputs to trace how the failed deployment and lost allocation are handled. Reproduce the scenario with the supplied job file, a failed deployment, and a lost node, then compare subsequent plan and run results. Done means the remaining allocation can be placed or the issue clearly reports why placement cannot proceed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.