我很難讓OpenShift V3與我的Github回購連接。我試圖按照https://learn.openshift.com上的教程進行操作,但他們沒有闡述OpenShift和Github之間的憑證問題。使Openshift V3與Github回購連接
然後,我嘗試通過CLI運行新的應用程序進程。沒有成功。
>oc new-app https://github.com/<repo>
--> Found image da99a88 (4 weeks old) in image stream "openshift/nodejs" under tag "6" for "nodejs"
Node.js 6
---------
Node.js 6 available as docker container is a base platform for building and running various Node.js 6 applications and frameworks. Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Tags: builder, nodejs, nodejs6
* The source repository appears to match: nodejs
* A source build using source code from https://github.com/<repo> will be created
* The resulting image will be pushed to image stream "appname:latest"
* Use 'start-build' to trigger a new build
* WARNING: this source repository may require credentials.
Create a secret with your git credentials and use 'set build-secret' to assign it to the build config.
* This image will be deployed in deployment config "appname"
* Port 8080/tcp will be load balanced by service "appname"
* Other containers can access this service through the hostname "appname"
--> Creating resources ...
imagestream "appname" created
buildconfig "appname" created
deploymentconfig "appname" created
service "appname" created
--> Success
Build scheduled, use 'oc logs -f bc/<repo>' to track its progress.
Run 'oc status' to view your app.
當我看就登錄它說,Openshift不能connest在Github上側回購
Cloning "https://github.com/<repo>" ...
error: build error: failed to fetch requested repository "https://github.com/<repo>" with provided credentials
更新:
通過繼非常有用的答案和評論user2983542 and Graham Dump leton,我創建了公共和私人的SSH keys
以下tutorial。我創建了一個帶有passphase的關鍵,但我有點困惑與下面的語句OpenShift blog:
一個可取之處是,OpenShift不會允許你使用一個密鑰對,其中私鑰有密碼。我相信你會遵循的最佳做法是,您的主要身份SSH密鑰應始終有一個密碼;這將防止您無意中使用您的主要身份SSH密鑰。
無論如何,我試圖進行通過......我在Github上部署了公鑰。之後,我在OpenShift上創建了secret
類型kubernetes.io/ssh-auth
,並將其作爲環境變量與部署關聯。
BuildConfig GitHub的部分看起來如下:
triggers:
- github:
secret: M6_whatever...
type: GitHub
部署失敗,出現以下消息:
--> Scaling myappname-1 to 1
--> Waiting up to 10m0s for pods in rc myappname-1 to become ready
error: update acceptor rejected myappname-1: pods for rc "myappname-1" took longer than 600 seconds to become ready
你能,請點我,我做錯了嗎?
您不應該使用您的主要身份SSH密鑰(id_rsa),因爲您可能將其用於其他事情,例如通過SSH訪問主機。在這種情況下,將您的私鑰上傳到單獨的系統是一個非常糟糕的主意。一個主要身份密鑰通常也有一個密碼短語,而OpenShift不能使用密鑰對和密碼短語。因此,創建一個單獨的密鑰對供OpenShift使用,並將公鑰作爲部署密鑰註冊到GitHub中的存儲庫中。 –
即將在blog.openshift.com上發佈一系列新博客文章,介紹如何使用OpenShift私有Git存儲庫以及您應該使用的各種最佳實踐。 –
公平點。我將更新我的答案以包含您的建議 – user2983542