Olá
Estou tentando incluir um hpa para o pod de portal notícias, mas quando executo get hpa ele não reconhece nenhuma replicas existentes.
O comando 'kubectl describe hpa portal-noticias-hpadescribe' retorna o seguinte erro : 'no matches for kind "Deployment" in group "" ' .
Vcs saberiam me dizer a causa e como posso corrigir ? Obrigado.
*Coloquei as copias dos arquivos de configuração e dos comandos abaixo
# kubectl.exe get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE portal-noticias-hpa Deployment/portal-noticias-deployment <unknown>/50% 1 10 0 15s
# PS C:\Users\gabri> kubectl describe hpa portal-noticias-hpa
Name: portal-noticias-hpa Namespace: default Labels: <none> Annotations: <none> CreationTimestamp: Thu, 06 May 2021 10:34:18 -0300 Reference: Deployment/portal-noticias-deployment Metrics: ( current / target ) resource cpu on pods (as a percentage of request): <unknown> / 50% Min replicas: 1 Max replicas: 10 Deployment pods: 0 current / 0 desired Conditions: Type Status Reason Message ---- ------ ------ ------- AbleToScale False FailedGetScale the HPA controller was unable to get the target's current scale: no matches for kind "Deployment" in group "" Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning FailedGetScale 19s (x3 over 2m20s) horizontal-pod-autoscaler no matches for kind "Deployment" in group ""
# portal-noticias-hpa.yml
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: portal-noticias-hpa
spec:
scaleTargetRef:
kind: Deployment
name: portal-noticias-deployment
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
# portal-noticias-deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: portal-noticias-deployment
spec:
template:
metadata:
name: portal-noticias
labels:
app: portal-noticias
spec:
containers:
- name: portal-noticias-container
image: aluracursos/portal-noticias:1
# resources:
# limits:
# memory: 512Mi
# cpu: "1"
# requests:
# memory: 256Mi
# cpu: "0.2"
ports:
- containerPort: 80
envFrom:
- configMapRef:
name: portal-configmap
readinessProbe:
httpGet:
path: /
port: 80
periodSeconds: 10
failureThreshold: 7
initialDelaySeconds: 3
livenessProbe:
httpGet:
path: /
port: 80
periodSeconds: 10
failureThreshold: 3
initialDelaySeconds: 20
replicas: 3
selector:
matchLabels:
app: portal-noticias