Memcached CRD Types Reference
API reference for the memcached.c5c3.io/v1alpha1 Custom Resource Definition types.
Source: api/v1alpha1/memcached_types.go
Memcached
Top-level custom resource representing a Memcached cluster.
Group: memcached.c5c3.ioVersion: v1alpha1Kind: MemcachedScope: Namespaced
Printer Columns
| Column | Type | JSONPath | Description |
|---|---|---|---|
| Replicas | integer | .spec.replicas | Number of desired Memcached pods |
| Ready | integer | .status.readyReplicas | Number of ready Memcached pods |
| Age | date | .metadata.creationTimestamp | Resource creation timestamp |
Subresources
- status: Enabled. Status updates use the
/statussubresource endpoint.
MemcachedSpec
Defines the desired state of a Memcached cluster.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
replicas | *int32 | No | 1 | Minimum: 0, Maximum: 64 | Number of Memcached pods |
image | *string | No | "memcached:1.6" | — | Container image for the Memcached server |
resources | *corev1.ResourceRequirements | No | — | — | Resource requests and limits for the container |
memcached | *MemcachedConfig | No | — | — | Memcached server configuration parameters |
highAvailability | *HighAvailabilitySpec | No | — | — | High-availability settings |
monitoring | *MonitoringSpec | No | — | — | Monitoring and metrics configuration |
security | *SecuritySpec | No | — | — | Security settings |
autoscaling | *AutoscalingSpec | No | — | — | Horizontal pod autoscaling configuration |
MemcachedConfig
Defines Memcached server runtime parameters. These are translated into memcached command-line flags by the reconciler.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
maxMemoryMB | int32 | No | 64 | Minimum: 16, Maximum: 65536 | Maximum memory for item storage in MB (-m flag) |
maxConnections | int32 | No | 1024 | Minimum: 1, Maximum: 65536 | Maximum simultaneous connections (-c flag) |
threads | int32 | No | 4 | Minimum: 1, Maximum: 128 | Number of worker threads (-t flag) |
maxItemSize | string | No | "1m" | Pattern: ^[0-9]+(k|m)$ | Maximum size of a single item (-I flag, e.g. "1m", "512k") |
verbosity | int32 | No | 0 | Minimum: 0, Maximum: 2 | Logging verbosity (0=none, 1=-v, 2=-vv) |
extraArgs | []string | No | — | — | Additional command-line arguments passed to memcached |
HighAvailabilitySpec
Defines high-availability settings for Memcached pods, including anti-affinity, topology spread, and pod disruption budgets.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
antiAffinityPreset | *AntiAffinityPreset | No | "soft" | Enum: soft, hard | Pod anti-affinity scheduling mode |
topologySpreadConstraints | []corev1.TopologySpreadConstraint | No | — | — | Topology domain spread constraints for pods |
podDisruptionBudget | *PDBSpec | No | — | — | PodDisruptionBudget configuration |
AntiAffinityPreset
String enum type controlling pod anti-affinity behavior.
| Value | Description |
|---|---|
soft | Uses preferredDuringSchedulingIgnoredDuringExecution |
hard | Uses requiredDuringSchedulingIgnoredDuringExecution |
PDBSpec
Defines PodDisruptionBudget configuration for Memcached pods.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
enabled | bool | No | false | — | Whether a PodDisruptionBudget is created |
minAvailable | *intstr.IntOrString | No | 1 | — | Minimum available pods during disruption (absolute or %) |
maxUnavailable | *intstr.IntOrString | No | — | — | Maximum unavailable pods during disruption (absolute or %) |
MonitoringSpec
Defines monitoring and metrics collection configuration, including the memcached-exporter sidecar and Prometheus ServiceMonitor.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
enabled | bool | No | false | — | Enables the memcached-exporter sidecar |
exporterImage | *string | No | "prom/memcached-exporter:v0.15.4" | — | Container image for the exporter sidecar |
exporterResources | *corev1.ResourceRequirements | No | — | — | Resource requests/limits for the exporter sidecar |
serviceMonitor | *ServiceMonitorSpec | No | — | — | Prometheus ServiceMonitor configuration |
ServiceMonitorSpec
Defines Prometheus ServiceMonitor resource configuration.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
additionalLabels | map[string]string | No | — | — | Extra labels added to the ServiceMonitor resource |
interval | string | No | "30s" | — | Prometheus scrape interval (e.g. "30s") |
scrapeTimeout | string | No | "10s" | — | Prometheus scrape timeout (e.g. "10s") |
SecuritySpec
Defines security settings for Memcached pods, including pod/container security contexts, authentication, and encryption.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
podSecurityContext | *corev1.PodSecurityContext | No | — | — | Security context for the Memcached pod |
containerSecurityContext | *corev1.SecurityContext | No | — | — | Security context for the Memcached container |
sasl | *SASLSpec | No | — | — | SASL authentication configuration |
tls | *TLSSpec | No | — | — | TLS encryption configuration |
SASLSpec
Defines SASL authentication configuration for Memcached.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
enabled | bool | No | false | — | Whether SASL authentication is active |
credentialsSecretRef | corev1.LocalObjectReference | No | — | — | Reference to the Secret containing a password-file key with SASL credentials |
TLSSpec
Defines TLS encryption configuration for Memcached.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
enabled | bool | No | false | — | Whether TLS encryption is active |
certificateSecretRef | corev1.LocalObjectReference | No | — | — | Reference to the Secret containing tls.crt, tls.key, and optionally ca.crt |
AutoscalingSpec
Defines horizontal pod autoscaling configuration for Memcached. When enabled is true, the operator creates an HPA resource targeting the Memcached StatefulSet. The StatefulSet keeps the replica count the HPA sets, and a new StatefulSet starts at minReplicas, or 1 when minReplicas is nil.
| Field | Type | Required | Default | Validation | Description |
|---|---|---|---|---|---|
enabled | bool | No | false | — | Controls whether horizontal pod autoscaling is active |
minReplicas | *int32 | No | — | Minimum: 1 | Lower limit for the number of replicas. When nil, the HPA default (1) is used |
maxReplicas | int32 | Yes | — | Minimum: 1 | Upper limit for the number of replicas |
metrics | []autoscalingv2.MetricSpec | No | — | — | Specifications for calculating desired replica count. When empty and autoscaling is enabled, the defaulting webhook injects a CPU utilization metric targeting 80% |
behavior | *autoscalingv2.HorizontalPodAutoscalerBehavior | No | — | — | Scaling behavior in both Up and Down directions. When nil and autoscaling is enabled, the defaulting webhook injects a scaleDown stabilization window of 300 seconds |
MemcachedStatus
Defines the observed state of a Memcached cluster, updated by the reconciler via the status subresource.
| Field | Type | Required | Description |
|---|---|---|---|
conditions | []metav1.Condition | No | Standard conditions with merge patch strategy (key: type) |
readyReplicas | int32 | No | Number of Memcached pods in Ready state |
observedGeneration | int64 | No | Most recent .metadata.generation observed by the controller |
serverList | []string | No | One host:port entry per pod, <statefulset>-<i>.<service>.<namespace>.svc:11211, ordered by pod index i. It follows the StatefulSet's replica count, not pod readiness, and is empty when the instance has zero replicas |
Full Example
A fully-specified Memcached CR demonstrating all available fields:
apiVersion: memcached.c5c3.io/v1alpha1
kind: Memcached
metadata:
name: memcached-production
namespace: cache
spec:
replicas: 3
image: "memcached:1.6"
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "256Mi"
memcached:
maxMemoryMB: 128
maxConnections: 2048
threads: 4
maxItemSize: "2m"
verbosity: 0
extraArgs:
- "-o"
- "modern"
highAvailability:
antiAffinityPreset: "soft"
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app.kubernetes.io/name: memcached-production
podDisruptionBudget:
enabled: true
minAvailable: 2
monitoring:
enabled: true
exporterImage: "prom/memcached-exporter:v0.15.4"
exporterResources:
requests:
cpu: "50m"
memory: "32Mi"
limits:
cpu: "100m"
memory: "64Mi"
serviceMonitor:
interval: "30s"
scrapeTimeout: "10s"
additionalLabels:
release: prometheus
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
security:
podSecurityContext:
runAsNonRoot: true
containerSecurityContext:
runAsUser: 11211
allowPrivilegeEscalation: false
sasl:
enabled: true
credentialsSecretRef:
name: memcached-sasl-credentials
tls:
enabled: true
certificateSecretRef:
name: memcached-tls-certsMinimal Example
A minimal CR relying on defaults:
apiVersion: memcached.c5c3.io/v1alpha1
kind: Memcached
metadata:
name: memcached-dev
spec:
replicas: 1This creates a single-replica Memcached pod with image memcached:1.6, 64 MB memory limit, 1024 max connections, 4 threads, and 1m max item size.