fabric8io / fabric8

fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
http://fabric8.io/
1.76k stars 504 forks source link

unable run recent fabric8 properly #6536

Open minikiller opened 7 years ago

minikiller commented 7 years ago

I worked under openshift 1.3,when i use gofabric8 deploy -y --pvc=false, the pod of exposecontroller can not start. The log info show:

I1110 12:49:13.100306       1 exposecontroller.go:47] Using build: '0.1.0'
F1110 12:49:13.199765       1 exposecontroller.go:66] failed to create new strategy: failed to create ingress expose strategy: failed to get a domain: no known automatic ways to get an external ip to use with xip
minikiller commented 7 years ago

I also install fabric8 before, now when i deploy new version it showing:

Processing resource kind: ProjectRequest in namespace sunlf
Failed to create ProjectRequest: project "user-secrets-source-admin" already existsplatform......................................................................✘ project "user-secrets-source-admin" already exists
Found namespace on kind Secret of user-secrets-source-adminProcessing resource kind: Secret in namespace user-secrets-source-admin
Processing resource kind: Secret in namespace sunlf
Processing resource kind: Secret in namespace sunlf
Processing resource kind: Secret in namespace sunlf
Processing resource kind: Secret in namespace sunlf
Processing resource kind: Secret in namespace sunlf
Processing resource kind: Secret in namespace sunlf
Processing resource kind: Secret in namespace sunlf
Processing resource kind: ServiceAccount in namespace sunlf
Processing resource kind: ServiceAccount in namespace sunlf
Processing resource kind: ServiceAccount in namespace sunlf
Processing resource kind: ServiceAccount in namespace sunlf
Processing resource kind: ServiceAccount in namespace sunlf
Processing resource kind: OAuthClient in namespace sunlf
Failed to create OAuthClient: oauthclients "fabric8" already existsplatform......................................................................✘ oauthclients "fabric8" already exists
Processing resource kind: OAuthClient in namespace sunlf
Processing resource kind: Service in namespace sunlf
Processing resource kind: Service in namespace sunlf
rawlingsj commented 7 years ago

Hi @minikiller - the exposecontroller tries to work out what type of router you're running. On some setups this needs to be configured manually.

You can..

oc edit configmap exposecontroller

and set the data attribute exposer: Route also add a wildcard DNS domain if you don't want to use the default xip.io

for more info see https://github.com/fabric8io/exposecontroller#configuration

we ought to add this link + FAQ to that error log you added.

minikiller commented 7 years ago

It works now,but when i create a new app of Golang,build failed . it show following error:

[?1034hsh-4.2# cd /home/jenkins/workspace/last
sh-4.2# sh -c echo $$ > '/home/jenkins/workspace/last@tmp/durable-193cf203/pid'; 
 jsc=durable-ac32b102e9ce9382aaed61095d13617d; JENKINS_SERVER_COOKIE=$jsc '/home 
/jenkins/workspace/last@tmp/durable-193cf203/script.sh' > '/home/jenkins/workspa 
ce/last@tmp/durable-193cf203/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/wor 
kspace/last@tmp/durable-193cf203/jenkins-result.txt' 
+ docker build -t 172.30.51.235:80/sunlf/last:2a66085 .
sh-4.2# exit
exit
WARNING: Error loading config file:EOF
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
rawlingsj commented 7 years ago

What OS are you running kubernetes on? I wonder if we need to change the DOCKER_HOST env var or the docker socket volume mount that's added to the build pod which does the docker build.

We use a reusable library so you can change these yourself to try different combinations.

DOCKER_HOST env var https://github.com/fabric8io/fabric8-pipeline-library/blob/master/vars/clientsNode.groovy#L10

docker socket https://github.com/fabric8io/fabric8-pipeline-library/blob/master/vars/clientsNode.groovy#L13

To try this out fork the git repo https://github.com/fabric8io/fabric8-pipeline-library

then you can make changes to the groovy above and push to your fork. Next you just point the @Library location to your fork. This annotation can be found at the top of your Jenkinsfile which is in the root of your golang project, similar to this https://github.com/fabric8io/fabric8-jenkinsfile-library/blob/master/golang/CanaryReleaseStage/Jenkinsfile#L2

There's a handy wiki in the fabric8 console that you can edit and save the Jenkinsfile if you've not seen it yet, it's the Source tab in the left hand menu of the UI.

minikiller commented 7 years ago

when i build go app manual for the second time, it passed. I don't know why.

rawlingsj commented 7 years ago

that's odd. @iocanel any ideas?

minikiller commented 7 years ago
[?1034hsh-4.2# cd /home/jenkins/workspace/helloworld

sh-4.2# sh -c echo $$ > '/home/jenkins/workspace/helloworld@tmp/durable-69e66d02 /pid'; jsc=durable-c6058df57ab796d43884a32a301c0b57; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/helloworld@tmp/durable-69e66d02/script.sh' > '/home/jen kins/workspace/helloworld@tmp/durable-69e66d02/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/helloworld@tmp/durable-69e66d02/jenkins-result.txt'

+ docker push 172.30.51.235:80/sunlf/helloworld:c1a541a

WARNING: Error loading config file:EOF

The push refers to a repository [172.30.51.235:80/sunlf/helloworld]

fb1775a74195: Preparing

bc415bf47541: Preparing

c02b8ae68eca: Preparing

e6eb97abd482: Preparing

2d9a008a6ee1: Preparing

a3e878ca1a1c: Preparing

4588c2179cdc: Preparing

9168b67dbc50: Preparing

9f17712cba0b: Preparing

223c0d04a137: Preparing

fe4c16cbf7a4: Preparing

a3e878ca1a1c: Waiting

9168b67dbc50: Waiting

4588c2179cdc: Waiting

fe4c16cbf7a4: Waiting

9f17712cba0b: Waiting

223c0d04a137: Waiting

e6eb97abd482: Mounted from sunlf/last

e6eb97abd482: Mounted from sunlf/last

2d9a008a6ee1: Mounted from sunlf/last

2d9a008a6ee1: Mounted from sunlf/last

a3e878ca1a1c: Mounted from sunlf/last

4588c2179cdc: Mounted from sunlf/last

4588c2179cdc: Mounted from sunlf/last

a3e878ca1a1c: Mounted from sunlf/last

9f17712cba0b: Mounted from sunlf/last

9f17712cba0b: Mounted from sunlf/last

9168b67dbc50: Mounted from sunlf/last

9168b67dbc50: Mounted from sunlf/last

223c0d04a137: Mounted from sunlf/last

223c0d04a137: Mounted from sunlf/last

fe4c16cbf7a4: Mounted from sunlf/last

fe4c16cbf7a4: Mounted from sunlf/last

bc415bf47541: Pushed

bc415bf47541: Pushed

c02b8ae68eca: Pushed

c02b8ae68eca: Pushed

fb1775a74195: Pushed

fb1775a74195: Pushed

sh-4.2# exit

exit

c1a541a: digest: sha256:8af56b6b8965b5f182dccb089621d1ac133e4c74e0883fd529383301d86710d8 size: 2604

[Pipeline] }

[Pipeline] // container

[Pipeline] }

[Pipeline] // node

[Pipeline] }

[Pipeline] // podTemplate

[Pipeline] echo

using Kubernetes resources:

{

"apiVersion" : "v1",

"kind" : "Template",

"labels" : { },

"metadata" : {

"annotations" : {

"description" : "golang example",

"fabric8.helloworld/iconUrl" : "https://cdn.rawgit.com/fabric8io/fabric8/dc05040/website/src/images/logos/gopher.png"

},

"labels" : { },

"name" : "helloworld"

},

"objects" : [{

"kind": "Service",

"apiVersion": "v1",

"metadata": {

"name": "helloworld",

"creationTimestamp": null,

"labels": {

"component": "helloworld",

"container": "golang",

"group": "quickstarts",

"project": "helloworld",

"provider": "fabric8",

"expose": "true",

"version": "c1a541a"

},

"annotations": {

"fabric8.helloworld/iconUrl" : "https://cdn.rawgit.com/fabric8io/fabric8/dc05040/website/src/images/logos/gopher.png",

"prometheus.io/port": "8080",

"prometheus.io/scheme": "http",

"prometheus.io/scrape": "true"

}

},

"spec": {

"ports": [

{

"protocol": "TCP",

"port": 80,

"targetPort": 8080

}

],

"selector": {

"component": "helloworld",

"container": "golang",

"group": "quickstarts",

"project": "helloworld",

"provider": "fabric8",

"version": "c1a541a"

},

"type": "LoadBalancer",

"sessionAffinity": "None"

}

},

{

"kind": "ReplicationController",

"apiVersion": "v1",

"metadata": {

"name": "helloworld",

"generation": 1,

"creationTimestamp": null,

"labels": {

"component": "helloworld",

"container": "golang",

"group": "quickstarts",

"project": "helloworld",

"provider": "fabric8",

"expose": "true",

"version": "c1a541a"

},

"annotations": {

"fabric8.helloworld/iconUrl" : "https://cdn.rawgit.com/fabric8io/fabric8/dc05040/website/src/images/logos/gopher.png"

}

},

"spec": {

"replicas": 1,

"selector": {

"component": "helloworld",

"container": "golang",

"group": "quickstarts",

"project": "helloworld",

"provider": "fabric8",

"version": "c1a541a"

},

"template": {

"metadata": {

"creationTimestamp": null,

"labels": {

"component": "helloworld",

"container": "golang",

"group": "quickstarts",

"project": "helloworld",

"provider": "fabric8",

"version": "c1a541a"

}

},

"spec": {

"containers": [

{

"name": "helloworld",

"image": "172.30.51.235:80/sunlf/helloworld:c1a541a",

"ports": [

{

"name": "web",

"containerPort": 8080,

"protocol": "TCP"

}

],

"env": [

{

"name": "KUBERNETES_NAMESPACE",

"valueFrom": {

"fieldRef": {

"apiVersion": "v1",

"fieldPath": "metadata.namespace"

}

}

}

],

"resources": {},

"terminationMessagePath": "/dev/termination-log",

"imagePullPolicy": "IfNotPresent",

"securityContext": {}

}

],

"restartPolicy": "Always",

"terminationGracePeriodSeconds": 30,

"dnsPolicy": "ClusterFirst",

"securityContext": {}

}

}

},

"status": {

"replicas": 0

}

}]}

[Pipeline] stage (Rollout Staging)

Using the ‘stage’ step without a block argument is deprecated

Entering stage Rollout Staging

Proceeding

[Pipeline] kubernetesApply

No fabric8.yml so unable to add environment pod annotations

No fabric8.yml so unable to add environment pod annotations

No fabric8.yml so unable to add environment pod annotations

No fabric8.yml so unable to add environment pod annotations

No fabric8.yml so unable to add environment pod annotations

Adapting resources to use pull images from registry: 172.30.51.235:80

About to apply resource[Service(apiVersion=v1, kind=Service, metadata=ObjectMeta(annotations={fabric8.helloworld/iconUrl=https://cdn.rawgit.com/fabric8io/fabric8/dc05040/website/src/images/logos/gopher.png, prometheus.io/port=8080, prometheus.io/scheme=http, prometheus.io/scrape=true}, creationTimestamp=null, deletionGracePeriodSeconds=null, deletionTimestamp=null, finalizers=[], generateName=null, generation=null, labels={component=helloworld, container=golang, group=quickstarts, project=helloworld, provider=fabric8, expose=true, version=c1a541a}, name=helloworld, namespace=null, ownerReferences=[], resourceVersion=null, selfLink=null, uid=null, additionalProperties={}), spec=ServiceSpec(clusterIP=null, deprecatedPublicIPs=[], externalIPs=[], loadBalancerIP=null, loadBalancerSourceRanges=[], portalIP=null, ports=[ServicePort(name=null, nodePort=null, port=80, protocol=TCP, targetPort=IntOrString(IntVal=8080, Kind=null, StrVal=null, additionalProperties={}), additionalProperties={})], selector={component=helloworld, container=golang, group=quickstarts, project=helloworld, provider=fabric8, version=c1a541a}, sessionAffinity=None, type=LoadBalancer, additionalProperties={}), status=null, additionalProperties={}), ReplicationController(apiVersion=v1, kind=ReplicationController, metadata=ObjectMeta(annotations={fabric8.helloworld/iconUrl=https://cdn.rawgit.com/fabric8io/fabric8/dc05040/website/src/images/logos/gopher.png}, creationTimestamp=null, deletionGracePeriodSeconds=null, deletionTimestamp=null, finalizers=[], generateName=null, generation=1, labels={component=helloworld, container=golang, group=quickstarts, project=helloworld, provider=fabric8, expose=true, version=c1a541a}, name=helloworld, namespace=null, ownerReferences=[], resourceVersion=null, selfLink=null, uid=null, additionalProperties={}), spec=ReplicationControllerSpec(replicas=1, selector={component=helloworld, container=golang, group=quickstarts, project=helloworld, provider=fabric8, version=c1a541a}, template=PodTemplateSpec(metadata=ObjectMeta(annotations=null, creationTimestamp=null, deletionGracePeriodSeconds=null, deletionTimestamp=null, finalizers=[], generateName=null, generation=null, labels={component=helloworld, container=golang, group=quickstarts, project=helloworld, provider=fabric8, version=c1a541a}, name=null, namespace=null, ownerReferences=[], resourceVersion=null, selfLink=null, uid=null, additionalProperties={}), spec=PodSpec(activeDeadlineSeconds=null, containers=[Container(args=[], command=[], env=[EnvVar(name=KUBERNETES_NAMESPACE, value=null, valueFrom=EnvVarSource(configMapKeyRef=null, fieldRef=ObjectFieldSelector(apiVersion=v1, fieldPath=metadata.namespace, additionalProperties={}), resourceFieldRef=null, secretKeyRef=null, additionalProperties={}), additionalProperties={})], image=172.30.51.235:80/sunlf/helloworld:c1a541a, imagePullPolicy=IfNotPresent, lifecycle=null, livenessProbe=null, name=helloworld, ports=[ContainerPort(containerPort=8080, hostIP=null, hostPort=null, name=web, protocol=TCP, additionalProperties={})], readinessProbe=null, resources=ResourceRequirements(limits=null, requests=null, additionalProperties={}), securityContext=SecurityContext(capabilities=null, privileged=null, readOnlyRootFilesystem=null, runAsNonRoot=null, runAsUser=null, seLinuxOptions=null, additionalProperties={}), stdin=null, stdinOnce=null, terminationMessagePath=/dev/termination-log, tty=null, volumeMounts=[], workingDir=null, additionalProperties={})], dnsPolicy=ClusterFirst, host=null, hostIPC=null, hostNetwork=null, hostPID=null, hostname=null, imagePullSecrets=[], nodeName=null, nodeSelector=null, restartPolicy=Always, securityContext=PodSecurityContext(fsGroup=null, runAsNonRoot=null, runAsUser=null, seLinuxOptions=null, supplementalGroups=[], additionalProperties={}), serviceAccount=null, serviceAccountName=null, subdomain=null, terminationGracePeriodSeconds=30, volumes=[], additionalProperties={}), additionalProperties={}), additionalProperties={}), status=ReplicationControllerStatus(fullyLabeledReplicas=null, observedGeneration=null, replicas=0, additionalProperties={}), additionalProperties={})]

ERROR: Unable to get git log: org.eclipse.jgit.api.errors.NoHeadException: No HEAD exists and no explicit starting revision was specified

[Pipeline] }

[Pipeline] // node

[Pipeline] End of Pipeline

Finished: SUCCESS

i coundn't find service of 172.30.51.235:80 address ,where is it? thanks!

minikiller commented 7 years ago

i see it is fabric8-docker-registry service. Why it not use openshift default registry?

rawlingsj commented 7 years ago

We initially use the same pipelines when running on Kubernetes and OpenShift so the fabric8 docker registry is deployed on both.

There's some extra effort related to security when working with the openshift registry so for now it was easiest to use this fabric8 one. Will, in fact we'll make use of the openshift s2i binary builder that uses the openshift registry OOTB and we already do this for Java application pipelines. Hopefully we'll get to this soon.

minikiller commented 7 years ago

@rawlingsj Thanks for your reply. Now if I have a go project that want to deploy it under fabric8, how can I do it to make a microserver using pipeline?

ambition-consulting commented 7 years ago

same problem on gke, works on second run.