openshift 学习笔记-1

来源:互联网 发布:it人才招聘 编辑:程序博客网 时间:2024/06/07 06:41

一、网络

  1. pod IP:172.17.0.3 –>docker 中的容器ip
  2. service IP:172.30.217.14 –>服务IP 用于pod间通信,可跨node节点,此IP是虚拟IP,物理机无法访问。
  3. route IP:192.168.226.144 –>暴露给外网的IP,路由到service–>container

二、oc 客户端

  • 查看版本
$oc versionoc v3.7.0-alpha.1+fdbd3dckubernetes v1.7.0+695f48a16ffeatures: Basic-AuthServer https://192.168.226.144:8443openshift v3.6.0-rc.0+98b3d56kubernetes v1.6.1+5115d708d7
  • 登陆
$oc versionoc v3.7.0-alpha.1+fdbd3dckubernetes v1.7.0+695f48a16ffeatures: Basic-AuthServer https://192.168.226.144:8443openshift v3.6.0-rc.0+98b3d56kubernetes v1.6.1+5115d708d7
  • 创建新项目
oc versionoc v3.7.0-alpha.1+fdbd3dckubernetes v1.7.0+695f48a16ffeatures: Basic-AuthServer https://192.168.226.144:8443openshift v3.6.0-rc.0+98b3d56kubernetes v1.6.1+5115d708d7#查新看一下结果:$oc get projectNAME             DISPLAY NAME   STATUShello-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 podNAME                      READY     STATUS    RESTARTS   AGEhello-openshift-1-3r588   1/1       Running   0          1m#查看详细信息oc describe pod hello-openshift-1-3r588Name:           hello-openshift-1-3r588Namespace:      hello-world-ocNode:           localhost/192.168.226.144Start Time:     Thu, 12 Oct 2017 15:25:28 +0800Labels:         app=hello-openshift                deployment=hello-openshift-1                deploymentconfig=hello-openshiftAnnotations:    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=restrictedStatus:         RunningIP:             172.17.0.4Created By:     ReplicationController/hello-openshift-1Controlled By:  ReplicationController/hello-openshift-1Containers:  hello-openshift:    Container ID:

三、系群管理员

默认集群管理员为 system:admin ,该用户没有密码,登陆需要依赖证书密钥。登陆方法如下:
oc命令行,直接执行:
oc login -u system:admin