一、网络
- pod IP:172.17.0.3 –>docker 中的容器ip
- service IP:172.30.217.14 –>服务IP 用于pod间通信,可跨node节点,此IP是虚拟IP,物理机无法访问。
- route IP:192.168.226.144 –>暴露给外网的IP,路由到service–>container
二、oc 客户端
- 查看版本
$oc version
oc v3.7.0-alpha.1+fdbd3dc
kubernetes v1.7.0+695f48a16f
features: Basic-Auth
Server https://192.168.226.144:8443
openshift v3.6.0-rc.0+98b3d56
kubernetes v1.6.1+5115d708d7
- 登陆
$oc version
oc v3.7.0-alpha.1+fdbd3dc
kubernetes v1.7.0+695f48a16f
features: Basic-Auth
Server https://192.168.226.144:8443
openshift v3.6.0-rc.0+98b3d56
kubernetes v1.6.1+5115d708d7
- 创建新项目
oc version
oc v3.7.0-alpha.1+fdbd3dc
kubernetes v1.7.0+695f48a16f
features: Basic-Auth
Server https://192.168.226.144:8443
openshift v3.6.0-rc.0+98b3d56
kubernetes v1.6.1+5115d708d7
#查新看一下结果:
$oc get project
NAME DISPLAY NAME STATUS
hello-world-oc Active
- 创建应用程序,部署镜像
$oc new-app openshift/hello-openshift
--> Found Docker image ecb93ca (11 hours old) from Docker Hub for "openshift/hello-openshift"
* An image stream will be created as "hello-openshift:latest" that will track this image
* This image will be deployed in deployment config "hello-openshift"
* Ports 8080/tcp, 8888/tcp will be load balanced by service "hello-openshift"
* Other containers can access this service through the hostname "hello-openshift"
* WARNING: Image "openshift/hello-openshift" runs as the 'root' user which may not be permitted by your cluster administrator
--> Creating resources ...
imagestream "hello-openshift" created
deploymentconfig "hello-openshift" created
service "hello-openshift" created
--> Success
Run 'oc status' to view your app.
#查询一下创建结果
$oc get pod
NAME READY STATUS RESTARTS AGE
hello-openshift-1-3r588 1/1 Running 0 1m
#查看详细信息
oc describe pod hello-openshift-1-3r588
Name: hello-openshift-1-3r588
Namespace: hello-world-oc
Node: localhost/192.168.226.144
Start Time: Thu, 12 Oct 2017 15:25:28 +0800
Labels: app=hello-openshift
deployment=hello-openshift-1
deploymentconfig=hello-openshift
Annotations: kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicationController","namespace":"hello-world-oc","name":"hello-openshift-1","uid":"82a46c44-af1e-11e7-a...
openshift.io/deployment-config.latest-version=1
openshift.io/deployment-config.name=hello-openshift
openshift.io/deployment.name=hello-openshift-1
openshift.io/generated-by=OpenShiftNewApp
openshift.io/scc=restricted
Status: Running
IP: 172.17.0.4
Created By: ReplicationController/hello-openshift-1
Controlled By: ReplicationController/hello-openshift-1
Containers:
hello-openshift:
Container ID:
三、系群管理员
默认集群管理员为 system:admin ,该用户没有密码,登陆需要依赖证书密钥。登陆方法如下:
oc命令行,直接执行:
oc login -u system:admin