consul
БесплатноБез исполняемых скриптовНе проверенHashiCorp Consul for service discovery, health checking, and service mesh. Use when the user needs to register services, perform health checks, store…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Consul
Overview
Consul provides service discovery, health checking, KV storage, and service mesh capabilities. The current release line is 2.x (2.0.4 as of September 2026); the commands below work the same on 1.x. Since 2023 Consul is under the Business Source License, not an open-source one: check the terms before offering it as a hosted product. Never run a production agent with -dev, which keeps everything in memory with no ACLs or TLS.
Instructions
Installation
# Install Consul
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install consul
# macOS alternative: brew tap hashicorp/tap && brew install hashicorp/tap/consul
# Start dev agent
consul agent -dev
# Check cluster members
consul members
Server Configuration
# consul-server.hcl — Production Consul server config
datacenter = "dc1"
data_dir = "/opt/consul/data"
log_level = "INFO"
server = true
bootstrap_expect = 3
bind_addr = "{{ GetPrivateInterfaces | include \"network\" \"10.0.0.0/8\" | attr \"address\" }}"
client_addr = "0.0.0.0"
ui_config { enabled = true }
connect { enabled = true }
ports {
grpc = 8502 # plaintext xDS for Envoy on the same host; disabled (-1) by default
grpc_tls = 8503 # TLS xDS for proxies on other hosts
}
# generate with: consul keygen
encrypt = "pUqJrVyVRj5jsiYEkM/tFQYfWyJIv4s3XkvDwy7Cu5s="
acl {
enabled = true
default_policy = "deny"
enable_token_persistence = true
tokens {
# agent token: needs node "<name>" write + service_prefix "" read
agent = "0b4f3c1e-7a52-4d0e-9c1b-5d2f8e6a1b34"
# default token for DNS and unauthenticated requests: read-only
default = "6e1d9a20-3c4b-4f77-8a0e-2b9c7d51f0aa"
}
}
tls {
defaults {
ca_file = "/opt/consul/tls/ca.pem"
cert_file = "/opt/consul/tls/server.pem"
key_file = "/opt/consul/tls/server-key.pem"
verify_incoming = true
verify_outgoing = true
}
internal_rpc {
verify_server_hostname = true
}
}
autopilot {
cleanup_dead_servers = true
last_contact_threshold = "200ms"
server_stabilization_time = "10s"
}
Service Registration
// services/web.json — Register web service with health check
{
"service": {
"name": "web",
"port": 8080,
"tags": ["production", "v2"],
"meta": {
"version": "2.0.0"
},
"check": {
"http": "http://localhost:8080/health",
"interval": "10s",
"timeout": "5s",
"deregister_critical_service_after": "30m"
}
}
}
consul services register services/web.json
consul services deregister -id=web
dig @127.0.0.1 -p 8600 web.service.consul SRV
curl http://localhost:8500/v1/health/service/web?passing=true
consul catalog services
consul catalog nodes
KV Store
# Key-value operations
consul kv put config/app/db_host "orders-db.internal.shopfront.io"
consul kv put config/app/db_port "5432"
consul kv get config/app/db_host
consul kv get -recurse config/app/
consul kv export config/ > backup.json
consul kv import @backup.json
consul kv delete config/app/db_host
consul kv delete -recurse config/app/
consul watch -type=key -key=config/app/db_host /scripts/reload.sh
Service Mesh (Connect)
# connect-proxy.hcl — Service with sidecar proxy
service {
name = "web"
port = 8080
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "api"
local_bind_port = 9091
}
upstreams {
destination_name = "database"
local_bind_port = 9092
}
}
}
}
}
Register the sidecar, then start Envoy next to the service (Envoy must be installed; the agent needs the gRPC port from the config above):
consul services register connect-proxy.hcl
consul connect envoy -sidecar-for web -token-file=/etc/consul.d/web.token
# intentions.hcl — Service intentions for access control
Kind = "service-intentions"
Name = "api"
Sources = [
{
Name = "web"
Action = "allow"
},
{
Name = "*"
Action = "deny"
}
]
# Manage intentions
consul config write intentions.hcl
consul config read -kind service-intentions -name api
consul intention check web api
The consul intention subcommands (create, list, ...) are deprecated since 1.9 in favour of the service-intentions config entry shown above; intention check is still the quick way to test a pair.
Prepared Queries
# Create prepared query for failover across datacenters
curl -X POST http://localhost:8500/v1/query \
-H "X-Consul-Token: $CONSUL_HTTP_TOKEN" -d '{
"Name": "web-query",
"Service": {
"Service": "web",
Установить consul в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл consul?
HashiCorp Consul for service discovery, health checking, and service mesh. Use when the user needs to register services, perform health checks, store configuration in the KV store, or set up Connect for secure service-to-service communication.
Как установить скилл consul?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл consul запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic