unable to decode "STDIN": Object 'Kind' is missing in - kubernetes

I am using docker desktop v 4.11.0
and Kubernetes v1.24.2
while decoding secrets I am getting this error
waiting for deletion: running [kubectl --context docker-desktop get -f - --ignore-not-found -ojson]
stdout: ""
stderr: "unable to decode "STDIN": Object 'Kind' is missing in '{"env":[{"name":"TMPDIR","value":"/tmp"},{"name":"POD_NAME","valueFrom":{"fieldRef":{"fieldPath":"metadata.name"}}}

The error indicates it is having an issue with the Kubernetes YAML manifest file that you are using to create Secret in Kubernetes.
Please check syntax errors and incorrect values; Please check ‘kind’ field and if it is missing you need to add it and to the YAML manifest as well; and then try to decode the secret.
Please check the official page for further reference.

Related

FluxCD on Azure AKS: Reconciler errors

I had to rerun flux bootstrap... on my cluster after a colleague accidentally ran flux bootstrap... on their new cluster using the existing branch and cluster from the same flux repo.
Running kubectl get gitrepositories -A has no errors -
flux-system flux-system ssh://git#git.group.net:7999/psmgsbb/flux.git stored artifact for revision 'master/252f6416c034bb67f06cc3e413e66704bc6b1069'
however I am seeing these errors now when I run flux logs --level=error
error ImagePolicy/post-processing-master-branch-policy.flux-system : Reconciler error cannot determine latest tag for policy version list argument cannot be empty
error HelmRelease/post-processing.post-processing-dev : Reconciler error previous release attempt remediation failed
error ImageRepository/post-processing-repository.flux-system : Reconciler error auth for "myacr.azurecr.io" not found in secret flux-system/psbombb-image-acr-auth-cc8mg5tk84
Regarding the secret above I ran:
kubcetl get secret -n flux-system psbombb-image-acr-auth-cc8mg5tk84 -oyaml
which gave me
apiVersion: v1
data:
.dockerconfigjson:
ewoJImRhdGEiOiAie1xuICBcI...<redacted>
kind: Secret
which decodes to
"data": "{
"auths": {
"myacr.azurecr.io": {
"auth":
"YTNlMTNlOGItYWQwNi00M2IzLTkyMjgtMjA0ZmQ2ODllMD<redacted>"
}
}
}"
So the ACR above myacr.azurecr.io does match the ACR in the secret. This error doesn't make sense to me?
Reconciler error auth for "myacr.azurecr.io" not found in secret flux-system/psbombb-image-acr-auth-cc8mg5tk84
So basically, do you know why reconcile fails now after a flux bootstrap?
Thank you
When flux bootstrap... was run accidentally on the cluster it upgraded kustomize to version 0.30.2. This was causing an issue with the formatting of the encrypted dockerconfigjson secret being written to Kubernetes.
When the dockerconfigjson contents were base64 decoded there were line feeds everywhere which seems to have caused the reconciler error whereby it could not find the ACR reference -> myacr.azurecr.io
I reverted the gotk-components.yaml kustomize-controller version back to the kustomize version prior to the accidental flux boostrap... i.e. from v03.2 to v022.3.
Once the Kubernetes Secret was recreated with the correct dockerconfigjson format, reconciliation started working correctly.

Deployment error while referring deployment yaml directly from remote URL

I have a file uploaded in cloud storage and when I try to deploy the yaml using the url of file it always throws below error, tried with multiple files and even with sample nginx yaml. Also I tried adding the same file in github repo but it did not help either
kubectl apply -f https://github.com/saurabhumathe/jfrog-docker-repo-simple-example/blob/master/nginx.yaml -n testnginx
error: error parsing https://github.com/saurabhumathe/jfrog-docker-repo-simple-example/blob/master/nginx.yaml: error converting YAML to JSON: yaml: line 148: mapping values are not allowed in this context
However, the same file works at below URL as given in k8s documentation.
https://k8s.io/examples/controllers/nginx-deployment.yaml
Does anyone know what the issue is with using yaml URL to deploy artefacts with kubectl ?
You are getting HTTP document instead of the yaml spec. Try using the raw url, example kubectl apply -f https://raw.githubusercontent.com/saurabhumathe/jfrog-docker-repo-simple-example/master/nginx.yaml

unable to create Istio bookinfo-gateway.yaml Gateway

While running this command k
kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
I am getting this error
Error from server (NotFound): error when deleting
"samples/bookinfo/networking/bookinfo-gateway.yaml": the server could
not find the requested resource (delete gatewaies.networking.istio.io
bookinfo-gateway)
Can someone please tell me how can i accept gatewaies plural ? or how to fix this error
Upgrading to latest kubectl solved the issue

kubernetes deployment- container not starting- error- InvalidImageName

Below is the Kubernetes deployment yaml file -container image section:
image: https://registry.ng.bluemix.net/****/test-service:test-branch-67
imagePullPolicy: Always
Below is the error message after deploying:
ubuntu#ip-xxxx:~$ kubectl logs test-deployment-69c6d8xxx -n test
Error from server (BadRequest): container "test-deployment" in pod "test-deployment-ccccxxx" is waiting to start: InvalidImageName
Another error log:
Failed to apply default image tag "https://registry.ng.bluemix.net/test/test-service:test-branch-66": couldn't parse image reference "https://registry.ng.bluemix.net/test/test-service:test-branch-66": invalid reference format
Any idea why the pod is not coming up?
Remove the https:// from the image name, and if you are using a private registry, make sure to use imagePullSecrets.
This could be because in your YAML file your image name would be wrong, maybe a tag missed, you can trace from there.
Please add your complete deployment file to know the problem in detail. But looking at the file make sure you are not missing
imagePullSecrets (Add valid credentials with access to pull the image from repository)
Also you need not provide the protocol like you added
https
Your image field in yml should look like below example:
image: repository:organization_name/image_name:image_version
curl --insecure -sfL https://192.168.2.217/v3/import/zc2t5qstv4l9f6wv8stmfsqcks47x7z5m4xnnrbf7hn9c9vj65bwd7_c-4mdds.yaml > tmp.yaml
# edit tmp.yaml file and delete https:/hub.docker.com/rancher/rancher-agent:v2.5.7 => rancher/rancher-agent:v2.5.7
# apply again:
kubectl apply -f tmp.yaml

Error install istio in GKE = the server could not find the requested resource (post `gatewaies.networking.istio.io`)

I have the following error when installing istio in GKE
kubernetes ver = 1.11.2-gke.18
Istio ver = 1.0.4
Kubectl = latest from repo google
Error from server (NotFound): error when creating
"`install/kubernetes/istio-demo-auth.yaml`":
the server could not find the requested resource
(post `gatewaies.networking.istio.io`)
I have tried to follow the tutorial on GCP:
https://cloud.google.com/kubernetes-engine/docs/tutorials/installing-istio
You are missing the CustomResourceDefinition required by istio and hence getting this error. You need to apply following command from istio folder:
kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml
This will create all the CRD's like virtualservice, destinationrules etc.
Try following official documentation of Istio to install it on GKE:
https://istio.io/docs/setup/kubernetes/quick-start-gke-dm/
I am also getting this issue when installing a custom Istio helm chart:
[tiller] 2019/11/15 21:50:52 failed install perform step: release test failed: the server could not find the requested resource (post gatewaies.networking.istio.io)
I've confirmed the Istio CRDs are installed properly. Note how the installed Gateway CRD explicitly notes the accepted plural name:
status:
acceptedNames:
categories:
- istio-io
- networking-istio-io
kind: Gateway
listKind: GatewayList
plural: gateways
shortNames:
- gw
singular: gateway
I created an issue on Helm to see if that is the culprit, otherwise, I can open an issue on Istio to see if that is either. I'm very confused where the source of this issue could be coming from.
**Note: ** The type of the Gateway resource is correct:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
istio works by defining a series of crds(Custom Resource Definition), for istio to work, you first need to run command like this:
kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml
for my version(istio v1.2.0), the command is
for i in install/kubernetes/helm/istio-init/files/crd*yaml; do kubectl apply -f $i; done
but as I follow the instructions from the documentatino, I still get the annoying messages:
Error from server (NotFound): error when creating "samples/bookinfo/networking/bookinfo-gateway.yaml": the server could not find the requested resource (post gatewaies.networking.istio.io)
as the hint implies, the requested resource "gatewaies.networking.istio.io" cannot be found, and then I list the crds:
kubectl get crd
and I got a list like this:
enter image description here
as I see inspect this, I find something wrong.
the message issued by kubectl is (post gatewaies.networking.istio.io), but the crd enlisted is post gateways.networking.istio.io, then everything is clear, the kubectl CLI issued a wrong plural for word "gateway", the correct form is gateways, instead of gatewaies, so to satisfy the command form, the crd must change.
And I edit this file:
vim install/kubernetes/helm/istio-init/files/crd-10.yaml
by changing the name from "gateways.networking.istio.io" to "gatewaies.networking.istio.io", everything is ok now.