Unable to run docker-compose file through skaffold in Openshift - docker-compose

I am trying to run docker-compose file through skaffold using the following command in Openshift,
skaffold init --compose-file docker-compose.yaml
This fails while building the project in Jenkins with the following error,
+ skaffold init --compose-file docker-compose.yaml --verbosity=info
time="2019-11-25T07:37:38Z" level=info msg="Skaffold &{Version:v0.37.0 ConfigVersion:skaffold/v1beta13 GitVersion: GitCommit:b3aa6b0a95ea1e87fd8420df195c3c2d35d8341a GitTreeState:clean BuildDate:2019-08-29T20:44:03Z GoVersion:go1.12.9 Compiler:gc Platform:linux/amd64}"
time="2019-11-25T07:37:38Z" level=info msg="running 'kompose convert' for file docker-compose.yaml"
time="2019-11-25T07:37:38Z" level=fatal msg="running kompose: exit status 1"
I am not able to understand the error and could not find anything from Internet. So, please help me to run the docker-compose file from skaffold in OpenShift.

Related

Basic skaffold run giving proxy error to run a Flask hello world

I'm new to Kubernetes and Skaffold. Tried to follow the blog article to run a Python Flask application using Skaffold.
https://mukherjee-aniket.medium.com/continuous-development-using-skaffold-with-local-kubernetes-cluster-with-hot-reload-61009e185258
But when I run the command skaffold dev --port-forward I get the below error message.
invalid skaffold config: proxy: unknown scheme: http
Steps to replicate:
Clone https://github.com/anikm1987/skaffold-kubernetes/tree/master/python_app_k8s
cd python_app_k8s
skaffold init
skaffold dev --port-forward

Kubernetes error when deploying in AWS, how to deploy

I'm trying to build a website in AWS using Docker and Kubernetes, however I'm getting the error The connection to the server localhost:8080 was refused - did you specify the right host or port?
I don’t have a specific file for Kubernetes, but a folder with all of them. So I'm building on this way:
docker build .
kubectl apply -f ./helm/cognos-proxy-login-chart --recursive
Docker command completed successfully.
Am I building in the right way? What should I do?

Kubernetes not found on skaffold dev command

I get this error when running skaffold dev command:
stdout: ""
stderr: "The connection to the server localhost:8080 was refused - did you specify the right host or port?\n"
cause: exit status 1 subtask=-1 task=DevLoop
unable to connect to Kubernetes: getting client config for Kubernetes client: error creating REST client config in-cluster: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
Should i set up the env variables?
For anyone facing something like this, try adding:
owner #{HOME}/.minikube/certs/* to /var/lib/snapd/apparmor/profiles/snap.docker.docker
and then run
apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.docker.docker

Gitlab + GKE + Gitlab CI unable to clone Repository

I'm trying to user GitLab CI with GKE cluster to execute pipelines. I have the experience using Docker runner, but GKE is still pretty new to me, here's what I did:
Create GKE cluster via Project settings in GitLab.
Install Helm Tiller via GitLab Project settings.
Install GitLab Runner via GitLab Project settings.
Create gitlab-ci.yml with the following content
before_script:
- php -v
standard:
image: falnyr/php-ci-tools:php-cs-fixer-7.0
script:
- php-cs-fixer fix --diff --dry-run --stop-on-violation -v --using-cache=no
lint:7.1:
image: falnyr/php-ci:7.1-no-xdebug
script:
- composer build
- php vendor/bin/parallel-lint --exclude vendor .
cache:
paths:
- vendor/
Push commit to the repository
Pipeline output is following
Running with gitlab-runner 10.3.0 (5cf5e19a)
on runner-gitlab-runner-666dd5fd55-h5xzh (04180b2e)
Using Kubernetes namespace: gitlab-managed-apps
Using Kubernetes executor with image falnyr/php-ci:7.1-no-xdebug ...
Waiting for pod gitlab-managed-apps/runner-04180b2e-project-5-concurrent-0nmpp7 to be running, status is Pending
Running on runner-04180b2e-project-5-concurrent-0nmpp7 via runner-gitlab-runner-666dd5fd55-h5xzh...
Cloning repository...
Cloning into '/group/project'...
remote: You are not allowed to download code from this project.
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx#git.domain.tld/group/project.git/': The requested URL returned error: 403
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1
Now I think that I should add a gitlab-ci-token user with password somewhere, not sure if it is supposed to work like this.
Thanks!
After reading more about the topic it seems that pipelines should be executed via HTTPS only (not SSH).
I enabled the HTTPS communication and when I execute the pipeline as the user in the project (admin that is not added to the project throws this error) it works without a problem.

ImagePullBackOff Error

I'm using Minikube on Windows based machine. On the same machine, I also have docker-machine setup.
I've pointed docker client towards minikube’s docker environment. This way, can see Docker environment inside Kubernetes.
Without issues, I can build docker images & run docker containers from Minikube VM. However, when I try to start any docker container via kubectl(from PowerShell), its failing to start primarily as if kubectl can't find docker image due to following error -
Failed to pull image "image name": rpc error: code = Unknown desc =
Error response from daemon: repository "image-repo-name" not found:
does not exist or no pull access Error syncing pod
I don't know what's missing. If "docker run" can access the image why "kubectl" can not do?
Here my Dockerfile:
FROM node:4.4
EXPOSE 9002
COPY server.js .
CMD node server.js
Make sure your image path in your yaml is correct. That image should exist on your local machine. It should be named with a number not "latest"
Have this in your deployment yaml:
image: redis:1.0.48
run "> docker images" to see the list of images on your machine.