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
Related
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
Please find the following image. I have typed kubectl apply -k directory but there is error regarding root path.
I hope someone can help. Is it only able to be deployed in Azure environment?
If I typed kubectl -f xxx.yaml file. The yaml is found but still error. Sorry I unable to reproduce the problem exists in kubelet once i started the minikube.
Use -f to specify A yaml file.
I want to deploy my project to the Kubernetes cluster. I want to deploy it by using command:
- kubectl set image deployment/$CLUSTER_NAME gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest
But here I get error :
It's a misleading error message.
Essentially instead of abcxyz/abcxyz:example you also need to specify the container name that the image should be assigned to so for example example=abcxyz/abcxyz:example.
It's quite complicated and misleading, I got to say. Public docs don't help much but the kubectl set image --help does.
The problem is that you might have MULTIPLE instances in the deployment. If you have only one you can do something like this (note that this works but it's not AS SPECIFIC as you might want):
# The part before = is the spec.template.spec.containers.name which is image's brother
kubectl set image deployments goliardiait-staging=gcr.io/goliardia-prod/goliardia-it-matrioska:2.12 --all
I'll update when I find what nails it. In your case:
kubectl set image deployment $CLUSTER_NAME=gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest --all
- kubectl set image deployment/$CLUSTER_NAME $INSTANSE_NAME=gcr.io/$PROJECT_ID/$DOCKER_REPOSITORY:latest
It is working with using command like this
I have a yaml file which I can use to create pods. I am using the dashboard so I can simply select yaml file and it will create pods. Pod will start the container and container will run the docker image. So now lets say I have done some changes in the docker image and want to deploy it again. For this, I will delete the already running pod and will upload the yaml file.
Instead of deleting and uploading yaml file again, is there any keyword available which will delete the already running pod/deployment and will recreate it.
Thanks
If you are using this for development you might get away with
containers:
- image: my/app:dev
imagePullPolicy: Always
With this, whenever your pod is recreated, you will get fresh image version.
That said, you need to use something like Deployment to have a pod restarted automaticaly, and then you can just kubectl delete my-pod-xxxxx-yyy to wipe old one and in few sec get the fresh, current one.
For prod, don't do that please. Just use tagged images and apply changed image to your Deployment with kubectl apply -f my.yaml or preferably something like Helm (but that is more complicated topic for starters)
I can't remember the StackOverflow question where I first saw this method, but here it is again:
kubectl --namespace thenamespace get pod thepod -o yaml | kubectl replace --save-config -f -
You can do that with all k8s resources.
Trying several options to resolve the issue with weave-net (How to fix weave-net CrashLoopBackOff for the second node?), I have decided to try calico instead of weave-net. The documentation for kubernetes tells I need only one or another. The command (as per documentation here https://github.com/projectcalico/calico-containers/tree/master/docs/cni/kubernetes/manifests/kubeadm) fails:
vagrant#vm-master:~$ sudo kubectl create -f https://github.com/projectcalico/calico-containers/blob/master/docs/cni/kubernetes/manifests/kubeadm/calico.yaml
yaml: line 6: mapping values are not allowed in this context
What I am doing wrong? Is it known issue? How can I fix/workaround it?
You need to reference the raw YAML file in your command, instead of the full GitHub HTML document:
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico-containers/master/docs/cni/kubernetes/manifests/kubeadm/calico.yaml
Simply replace your HTML URL with raw data URL, it will work.