Comments (11)
A couple of updates. I'm running k8s on GKE. I'm not sure how to set this docker secret:
registry:
url: "registry.io/user"
credentials:
# dockercfg secret
secretKeyRef:
name: regsecret
key: .dockercfg
I believe the URL is "gcr.io", and we don't really need credentials since the registry is by default accesible from within the cluster?
from gitkube-example.
@rusucosmin It should be almost instantaneous. Can you paste the output of
$ kubectl get pods -n kube-system | grep gitkube
$ kubectl get svc -n kube-system gitkubed
and finally your remote
$ kubectl get remotes <remote-name> -o yaml
from gitkube-example.
@tirumaraiselvan thanks for the quick response:
$ kubectl get pods -n kube-system | grep gitkube
gitkube-controller-79fcb89689-flpt2 1/1 Running 0 1h
gitkubed-6ccb9b8c6c-gghp2 1/1 Running 0 15m
apiVersion: gitkube.sh/v1alpha1
kind: Remote
metadata:
clusterName: ""
creationTimestamp: 2018-03-29T18:43:52Z
deletionGracePeriodSeconds: null
deletionTimestamp: null
initializers: null
name: example
namespace: default
resourceVersion: "250597"
selfLink: /apis/gitkube.sh/v1alpha1/namespaces/default/remotes/example
uid: 209b5a19-3381-11e8-bc77-42010a84004c
spec:
authorizedKeys:
- ssh-rsa apiVersion: gitkube.sh/v1alpha1
kind: Remote
metadata:
clusterName: ""
creationTimestamp: 2018-03-29T18:43:52Z
deletionGracePeriodSeconds: null
deletionTimestamp: null
initializers: null
name: example
namespace: default
resourceVersion: "250597"
selfLink: /apis/gitkube.sh/v1alpha1/namespaces/default/remotes/example
uid: 209b5a19-3381-11e8-bc77-42010a84004c
spec:
authorizedKeys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDdTIotLAand_so_on
rusucosmin@rhino
deployments:
- containers:
- dockerfile: Dockerfile
name: nginx
path: .
name: nginx
registry:
url: gcr.io/dutylabs-adhoc rusucosmin@rhino
deployments:
- containers:
- dockerfile: Dockerfile
name: nginx
path: .
name: nginx
registry:
url: gcr.io/dutylabs-adhoc
from gitkube-example.
@rusucosmin I would also need
$ kubectl get svc -n kube-system gitkubed
and I think there is some error in copying the output of
$ kubectl get remotes <remote-name> -o yaml
For e.g. in this example, it should be
$ kubectl get remotes example -o yaml
Can you please check that again?
from gitkube-example.
Yes, here it is:
$ kubectl get svc -n kube-system gitkubed
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
gitkubed LoadBalancer 10.51.248.38 35.195.243.80 22:32320/TCP 1h
$ kubectl get remotes example -o yaml
apiVersion: gitkube.sh/v1alpha1
kind: Remote
metadata:
clusterName: ""
creationTimestamp: 2018-03-29T18:43:52Z
generation: 0
initializers: null
name: example
namespace: default
resourceVersion: "251571"
selfLink: /apis/gitkube.sh/v1alpha1/namespaces/default/remotes/example
uid: 209b5a19-3381-11e8-bc77-42010a84004c
spec:
authorizedKeys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDdTIotLA9WQblahblahblah
rusucosmin@rhino
deployments:
- containers:
- dockerfile: Dockerfile
name: nginx
path: .
name: nginx
registry:
credentials:
secretKeyRef:
key: ""
url: gcr.io/dutylabs-adhoc
status:
remoteUrl: ssh://[email protected]/~/git/default-example
remoteUrlDesc: ""
from gitkube-example.
All looks good here. I can also see that a remoteUrl
was generated ( see the status
section). Did it just work now after a long time? Or are you still seeing some null output somewhere?
from gitkube-example.
Oh yeah, just noticed it actually worked!
kubectl get remotes ✖ ✹ ✭
NAME AGE
example 34m
I think I only had to specify:
registry:
url: "gcr.io/project-name"
without the credentials.
Thanks a lot, I'll close this issue.
from gitkube-example.
No problem @rusucosmin . So I assume you are able to do a git push successfully?
from gitkube-example.
I'm having some issues right now with the git push example master
command.
$ git push example master
Counting objects: 24, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (24/24), 6.66 KiB | 2.22 MiB/s, done.
Total 24 (delta 8), reused 0 (delta 0)
remote: Gitkube build system : Thu Mar 29 19:35:36 UTC 2018: Initialising
remote:
remote: Creating the build directory
remote: Checking out 'master:e5db63feb6f7b36107c8803a2a4623d6880fcab5' to '/home/default-example/build/default-example'
remote:
remote: 1 deployment(s) found in this repo
remote: Trying to build them...
remote:
remote: Building Docker image for : nginx
remote:
remote: Building Docker image : gcr.io/dutylabs-adhoc/default-example-default.nginx-nginx:e5db63feb6f7b36107c8803a2a4623d6880fcab5
remote: WARNING: Error loading config file:/home/default-example/.dockercfg - Invalid Auth config file
remote: Sending build context to Docker daemon 12.29 kB
remote: Step 1/2 : FROM nginx:stable-alpine
remote: ---> 24ed1c575f81
remote: Step 2/2 : COPY html/ /usr/share/nginx/html
remote: ---> Using cache
remote: ---> b548b307adc2
remote: Successfully built b548b307adc2
remote: pushing gcr.io/dutylabs-adhoc/default-example-default.nginx-nginx:e5db63feb6f7b36107c8803a2a4623d6880fcab5 to registry
remote: WARNING: Error loading config file:/home/default-example/.dockercfg - Invalid Auth config file
remote: The push refers to a repository [gcr.io/dutylabs-adhoc/default-example-default.nginx-nginx]
remote: e1309e052ca1: Preparing
remote: 68695a6cfd7d: Preparing
remote: c1dc81a64903: Preparing
remote: 8460a579ab63: Preparing
remote: d39d92664027: Preparing
remote: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
To ssh://35.195.243.80/~/git/default-example
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://[email protected]/~/git/default-example'
Here is the full output of the command.
from gitkube-example.
As the error suggests, it seems gitkube is not authorized to push to gcr. I haven't worked with gcr authentication yet. But I looked up the docs. It is a straightforward process to create the secret: https://cloud.google.com/container-registry/docs/advanced-authentication#using_a_json_key_file
-
Download the JSON key for your Container Registry service account : https://support.google.com/cloud/answer/6158849#serviceaccounts (let's call it keyfile.json)
-
Create a docker-registry secret with the following command:
Make sure your kubectl client version is 1.8 or prior. Latest client version 1.9 has a issue: hasura/gitkube#38 . If you have 1.9, just download 1.8 somewhere and execute it directly.
$ kubectl create secret docker-registry regsecret --docker-server=https://gcr.io --docker-username="_json_key" --docker-password="$(cat keyfile.json)" --docker-email=<your-email>
- Add
credentials
to yourremote.yaml
registry:
url: gcr.io/dutylabs-adhoc/
credentials:
# dockercfg secret
secretKeyRef:
name: regsecret
key: .dockercfg
- Replace your remote with the new spec:
$ kubectl replace -f remote.yaml
- Push
from gitkube-example.
Thanks, it worked now. I had locally version 1.9 but on the servers 1.8 so I connected from the google cloud console shell and run the secret from there.
This project is very useful, great job!
from gitkube-example.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitkube-example.