Get your first Stellar validator node running on Kubernetes in minutes.
This guide will help you deploy a basic Stellar testnet validator node using Stellar-K8s. You'll learn how to:
- Create a StellarValidator custom resource
- Verify the deployment
- Check node status and logs
- Connect to the Stellar testnet
!!! info "Prerequisites" Before starting, ensure you've completed the Prerequisites and Installation guides.
Create a dedicated namespace for your Stellar nodes:
kubectl create namespace stellar-testnetCreate a validator configuration file:
apiVersion: stellar.k8s.io/v1alpha1
kind: StellarValidator
metadata:
name: my-testnet-validator
namespace: stellar-testnet
spec:
network: testnet
replicas: 1
# Node configuration
config:
nodeIsValidator: true
publicNetwork: true
catchupRecent: 1024
# Storage configuration
storage:
size: 500Gi
storageClassName: standard
# Resource requests and limits
resources:
requests:
cpu: "4"
memory: "8Gi"
limits:
cpu: "8"
memory: "16Gi"
# Monitoring
monitoring:
enabled: true
serviceMonitor: trueApply the configuration:
kubectl apply -f testnet-validator.yamlkubectl get stellarvalidators -n stellar-testnetExpected output:
NAME NETWORK REPLICAS READY AGE
my-testnet-validator testnet 1 1/1 2m30s
kubectl get pods -n stellar-testnet -l app=my-testnet-validatorWait for the pod to be in Running state:
NAME READY STATUS RESTARTS AGE
my-testnet-validator-0 1/1 Running 0 3m
kubectl get pvc -n stellar-testnetVerify the volume is bound:
NAME STATUS VOLUME CAPACITY ACCESS MODES AGE
data-my-testnet-validator-0 Bound pvc-xyz... 500Gi RWO 3m
kubectl logs -n stellar-testnet my-testnet-validator-0 -fLook for successful startup messages:
2024-06-02T10:30:15.123 INFO [default] Node starting...
2024-06-02T10:30:16.456 INFO [Herder] Joining network: testnet
2024-06-02T10:30:20.789 INFO [Herder] Connected to peers
2024-06-02T10:30:25.012 INFO [History] Catching up to network
Get node information using kubectl exec:
kubectl exec -n stellar-testnet my-testnet-validator-0 -- \
stellar-core --c infokubectl exec -n stellar-testnet my-testnet-validator-0 -- \
stellar-core --c peersYou should see active peer connections:
{
"authenticated_peers": {
"inbound": 5,
"outbound": 8
}
}kubectl exec -n stellar-testnet my-testnet-validator-0 -- \
stellar-core --c 'll?level=info'If monitoring is enabled, access Prometheus metrics:
# Port-forward to metrics endpoint
kubectl port-forward -n stellar-testnet my-testnet-validator-0 11626:11626
# In another terminal, query metrics
curl http://localhost:11626/metricsTo expose your validator for external peer connections, create a Service:
apiVersion: v1
kind: Service
metadata:
name: my-testnet-validator-external
namespace: stellar-testnet
spec:
type: LoadBalancer
selector:
app: my-testnet-validator
ports:
- name: peer
port: 11625
targetPort: 11625
protocol: TCPApply and get external IP:
kubectl apply -f validator-service.yaml
kubectl get svc -n stellar-testnet my-testnet-validator-externalkubectl patch stellarvalidator my-testnet-validator \
-n stellar-testnet \
--type='merge' \
-p '{"spec":{"replicas":3}}'Edit the validator resource:
kubectl edit stellarvalidator my-testnet-validator -n stellar-testnetDelete the pod to trigger a restart:
kubectl delete pod -n stellar-testnet my-testnet-validator-0The StatefulSet will automatically recreate it.
kubectl get events -n stellar-testnet --sort-by='.lastTimestamp'To remove the validator:
# Delete the validator resource
kubectl delete stellarvalidator my-testnet-validator -n stellar-testnet
# Delete the namespace (removes all resources)
kubectl delete namespace stellar-testnet!!! warning "Data Persistence" Deleting the namespace will also delete PersistentVolumeClaims. Ensure you've backed up any important data.
Now that you have a basic validator running:
- Configure High Availability for production deployments
- Set up Monitoring with Grafana dashboards
- Deploy Horizon API to query the network
- Troubleshoot common issues
Use this checklist to verify your deployment:
- Validator resource created and shows READY 1/1
- Pod is in Running state
- PersistentVolumeClaim is Bound
- Node logs show successful network connection
- Peer connections are established (min 5 peers)
- Node is syncing or caught up with the network
- Metrics endpoint is accessible (if monitoring enabled)
!!! success "Congratulations!" You've successfully deployed your first Stellar validator node on Kubernetes! 🎉