Openshift

[root@openshift ~]# yum install docker wget vim -y

[root@openshift ~]# vim /etc/sysconfig/docker

INSECURE_REGISTRY=’–insecure-registry 172.30.0.0/16′
[root@openshift ~]# systemctl restart docker

[root@openshift ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

[root@openshift ~]# cd /tmp

[root@openshift tmp]# wget https://github.com/openshift/origin/releases/download/v1.3.0/openshift-origin-server-v1.3.0-3ab7af3d097b57f933eccef684a714f2368804e7-linux-64bit.tar.gz

[root@openshift tmp]# ls -l
total 60912
-rw-r–r–. 1 root root 62373092 Sep 16 01:36 openshift-origin-server-v1.3.0-3ab7af3d097b57f933eccef684a714f2368804e7-linux-64bit.tar.gz

[root@openshift tmp]# tar xf openshift-origin-server-*.tar.gz

[root@openshift tmp]# cd openshift-origin-server-v1.3.0-3ab7af3d097b57f933eccef684a714f2368804e7-linux-64bit

[root@openshift openshift-origin-server-v1.3.0-3ab7af3d097b57f933eccef684a714f2368804e7-linux-64bit]# ls -l
total 1637216
-rwxr-xr-x. 7 root root 211772156 Sep 16 01:11 kube-apiserver
-rwxr-xr-x. 7 root root 211772156 Sep 16 01:11 kube-controller-manager
-rwxr-xr-x. 2 root root 97018178 Sep 16 01:11 kubectl
-rwxr-xr-x. 7 root root 211772156 Sep 16 01:11 kubelet
-rwxr-xr-x. 7 root root 211772156 Sep 16 01:11 kube-proxy
-rwxr-xr-x. 7 root root 211772156 Sep 16 01:11 kube-scheduler
-rw-r–r–. 1 root root 10759 Sep 16 01:11 LICENSE
-rwxr-xr-x. 7 root root 211772156 Sep 16 01:11 oadm
-rwxr-xr-x. 2 root root 97018178 Sep 16 01:11 oc
-rwxr-xr-x. 7 root root 211772156 Sep 16 01:11 openshift
-rw-r–r–. 1 root root 20497 Sep 16 01:11 README.md

[root@openshift openshift-origin-server-v1.3.0-3ab7af3d097b57f933eccef684a714f2368804e7-linux-64bit]# mv k* o* /usr/local/sbin/

[root@openshift ~]# vim /usr/local/bin/start_openshift.sh
#!/bin/bash
cd /opt/openshift/
openshift start –public-master=’https://146.148.36.62:8443′ –master=’https://10.128.0.3:8443′

[root@openshift ~]# vim /etc/systemd/system/openshift.service
[Unit]
Description=OpenShift Origin Server

[Service]
Type=simple
ExecStart=/usr/local/bin/start_openshift.sh
[root@openshift ~]# chmod u+x /usr/local/bin/start_openshift.sh

[root@openshift ~]# mkdir /opt/openshift/

[root@openshift ~]# systemctl daemon-reload

[root@openshift ~]# systemctl start openshift

[root@openshift ~]# vim /root/.bashrc
export KUBECONFIG=/opt/openshift/openshift.local.config/master/admin.kubeconfig
export CURL_CA_BUNDLE=/opt/openshift/openshift.local.config/master/ca.crt

[root@openshift ~]# source /root/.bashrc

[root@openshift ~]# oc login -u system:admin
Logged into “https://10.128.0.3:8443” as “system:admin” using existing credentials.

You have access to the following projects and can switch between them with ‘oc project <projectname>’:

* default
kube-system
openshift
openshift-infra

Using project “default”.

[root@openshift ~]# oadm policy add-scc-to-user hostnetwork -z router

[root@openshift ~]# oadm router
info: password for stats user admin has been set to z5qOuSX2xU
–> Creating router router …
serviceaccount “router” created
clusterrolebinding “router-router-role” created
deploymentconfig “router” created
service “router” created
–> Success

[root@openshift ~]# oadm registry
–> Creating registry registry …
serviceaccount “registry” created
clusterrolebinding “registry-registry-role” created
deploymentconfig “docker-registry” created
service “docker-registry” created
–> Success

open1open2open3open4open5open6open7open8open9open11open12open14

==================
<PUBLIC_IP> <OPENSHIFT_GENERATED_HOSTNAME>
http://test-route-rafi.router.default.svc.cluster.local/

https://146.148.36.62/test-route-rafi.router.default.svc.cluster.local/
[root@openshift ~]# netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:10443 0.0.0.0:* LISTEN 6718/haproxy
tcp 0 0 127.0.0.1:10444 0.0.0.0:* LISTEN 6718/haproxy
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6718/haproxy
tcp 0 0 0.0.0.0:1936 0.0.0.0:* LISTEN 6718/haproxy
tcp 0 0 10.128.0.3:53 0.0.0.0:* LISTEN 1844/openshift
tcp 0 0 0.0.0.0:8053 0.0.0.0:* LISTEN 1844/openshift
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 965/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1065/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 6718/haproxy
tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 1844/openshift
tcp6 0 0 :::10250 :::* LISTEN 1844/openshift
tcp6 0 0 :::22 :::* LISTEN 965/sshd
tcp6 0 0 :::7001 :::* LISTEN 1844/openshift
tcp6 0 0 ::1:25 :::* LISTEN 1065/master
tcp6 0 0 :::4001 :::* LISTEN 1844/openshift

[root@openshift ~]# kubectl
kubectl controls the Kubernetes cluster manager.

Find more information at https://github.com/kubernetes/kubernetes.

Available Commands:
annotate Update the annotations on a resource
api-versions Print the supported API versions on the server, in the form of “group/version”.
apply Apply a configuration to a resource by filename or stdin
attach Attach to a running container.
autoscale Auto-scale a Deployment, ReplicaSet, or ReplicationController
cluster-info Display cluster info
completion Output shell completion code for the given shell (bash or zsh)
config config modifies kubeconfig files
convert Convert config files between different API versions
cordon Mark node as unschedulable
create Create a resource by filename or stdin
delete Delete resources by filenames, stdin, resources and names, or by resources and label selector.
describe Show details of a specific resource or group of resources
drain Drain node in preparation for maintenance
edit Edit a resource on the server
exec Execute a command in a container.
explain Documentation of resources.
expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
get Display one or many resources
help Help about any command
label Update the labels on a resource
logs Print the logs for a container in a pod.
namespace SUPERSEDED: Set and view the current Kubernetes namespace
patch Update field(s) of a resource using strategic merge patch.
port-forward Forward one or more local ports to a pod.
proxy Run a proxy to the Kubernetes API server
replace Replace a resource by filename or stdin.
rolling-update Perform a rolling update of the given ReplicationController.
rollout rollout manages a deployment
run Run a particular image on the cluster.
scale Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
set Set specific features on objects
stop Deprecated: Gracefully shut down a resource by name or filename.
taint Update the taints on one or more nodes
uncordon Mark node as schedulable
version Print the client and server version information.

Use “kubectl <command> –help” for more information about a given command.
Use “kubectl options” for a list of global command-line options (applies to all commands).

[root@openshift ~]# kubectl cluster-info
Kubernetes master is running at https://10.128.0.3:8443

To further debug and diagnose cluster problems, use ‘kubectl cluster-info dump’.

[root@openshift ~]# kubectl cluster-info dump
{
“metadata”: {
“selfLink”: “/api/v1/nodes”,
“resourceVersion”: “1580”
},
“items”: [
{
“metadata”: {
“name”: “openshift.c.rich-operand-154505.internal”,
“selfLink”: “/api/v1/nodes/openshift.c.rich-operand-154505.internal”,
“uid”: “592a3199-dfa1-11e6-9d00-42010a800003”,
“resourceVersion”: “1577”,
“creationTimestamp”: “2017-01-21T06:17:56Z”,
“labels”: {
“beta.kubernetes.io/arch”: “amd64”,
“beta.kubernetes.io/os”: “linux”,
“kubernetes.io/hostname”: “openshift.c.rich-operand-154505.internal”
}
},
“spec”: {
“externalID”: “openshift.c.rich-operand-154505.internal”,
“providerID”: “gce:////3096749595366999774”
},
“status”: {
“capacity”: {
“alpha.kubernetes.io/nvidia-gpu”: “0”,
“cpu”: “1”,
“memory”: “3789000Ki”,
“pods”: “110”
},
“allocatable”: {
“alpha.kubernetes.io/nvidia-gpu”: “0”,
“cpu”: “1”,
“memory”: “3789000Ki”,
“pods”: “110”
},
“conditions”: [
{
“type”: “OutOfDisk”,
“status”: “False”,
“lastHeartbeatTime”: “2017-01-21T06:55:19Z”,
“lastTransitionTime”: “2017-01-21T06:17:55Z”,
“reason”: “KubeletHasSufficientDisk”,
“message”: “kubelet has sufficient disk space available”
},
{
“type”: “MemoryPressure”,
“status”: “False”,
“lastHeartbeatTime”: “2017-01-21T06:55:19Z”,
“lastTransitionTime”: “2017-01-21T06:17:55Z”,
“reason”: “KubeletHasSufficientMemory”,
“message”: “kubelet has sufficient memory available”
},
{
“type”: “Ready”,
“status”: “True”,
“lastHeartbeatTime”: “2017-01-21T06:55:19Z”,
“lastTransitionTime”: “2017-01-21T06:17:56Z”,
“reason”: “KubeletReady”,
“message”: “kubelet is posting ready status”
}
],
“addresses”: [
{
“type”: “LegacyHostIP”,
“address”: “10.128.0.3”
},
{
“type”: “InternalIP”,
“address”: “10.128.0.3”
}
],
“daemonEndpoints”: {
“kubeletEndpoint”: {
“Port”: 10250
}
},
“nodeInfo”: {
“machineID”: “7b0366439e80b7ac82b240417d33685a”,
“systemUUID”: “F3696425-6CFC-7A74-C824-9CABD40DFD5F”,
“bootID”: “e6fa523f-469e-4811-820e-047dff9131e7”,
“kernelVersion”: “3.10.0-514.2.2.el7.x86_64”,
“osImage”: “CentOS Linux 7 (Core)”,
“containerRuntimeVersion”: “docker://1.10.3”,
“kubeletVersion”: “v1.3.0+52492b4”,
“kubeProxyVersion”: “v1.3.0+52492b4”,
“operatingSystem”: “linux”,
“architecture”: “amd64”
},
“images”: [
{
“names”: [
“docker.io/openshift/origin-haproxy-router:v1.3.0”,
“docker.io/openshift/origin-haproxy-router@sha256:267f8c852a67c105aa480ff811a10fb29bf378b22b5d350e98984f8cca002aba”
],
“sizeBytes”: 506218361
},
{
“names”: [
“docker.io/openshift/origin-deployer:v1.3.0”,
“docker.io/openshift/origin-deployer@sha256:18a8e17bc3f435209808903e6d039363ca7127cb28d124b7391e6a74f386ea4d”
],
“sizeBytes”: 487077044
},
{
“names”: [
“docker.io/openshift/origin-docker-registry:v1.3.0”,
“docker.io/openshift/origin-docker-registry@sha256:1b36b8ba2fc3905739eab420641d7d4c14cdd8c3a855c62d77d1cc0ea0a141ab”
],
“sizeBytes”: 345514592
},
{
“names”: [
“docker.io/ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950”
],
“sizeBytes”: 129465861
},
{
“names”: [
“docker.io/openshift/hello-openshift@sha256:fa21972b6f7e26a7cbe0f0fab026c7c906aae7c95c63de85a6f1c0a40bb4722b”
],
“sizeBytes”: 5635062
},
{
“names”: [
“docker.io/openshift/origin-pod:v1.3.0”,
“docker.io/openshift/origin-pod@sha256:514f8abc7d59b5e3ded61361da76cce9f5e2421db2a45109cfdf3d335aa8327d”
],
“sizeBytes”: 1590856
}
]
}
}
]
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/kube-system/events”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/kube-system/replicationcontrollers”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/kube-system/services”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/apis/extensions/v1beta1/namespaces/kube-system/daemonsets”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/apis/extensions/v1beta1/namespaces/kube-system/deployments”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/apis/extensions/v1beta1/namespaces/kube-system/replicasets”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/kube-system/pods”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/openshift/events”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/openshift/replicationcontrollers”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/openshift/services”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/apis/extensions/v1beta1/namespaces/openshift/daemonsets”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/apis/extensions/v1beta1/namespaces/openshift/deployments”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/apis/extensions/v1beta1/namespaces/openshift/replicasets”,
“resourceVersion”: “1580”
},
“items”: []
}
{
“metadata”: {
“selfLink”: “/api/v1/namespaces/openshift/pods”,
“resourceVersion”: “1580”
},
“items”: []
}
Cluster info dumped to .
[root@openshift ~]#
[root@openshift ~]# kubectl version
Client Version: version.Info{Major:”1″, Minor:”3″, GitVersion:”v1.3.0+52492b4″, GitCommit:”52492b4″, GitTreeState:”clean”, BuildDate:”2016-09-16T00:45:44Z”, GoVersion:”go1.6.3″, Compiler:”gc”, Platform:”linux/amd64″}
Server Version: version.Info{Major:”1″, Minor:”3″, GitVersion:”v1.3.0+52492b4″, GitCommit:”52492b4″, GitTreeState:”clean”, BuildDate:”2016-09-16T00:45:44Z”, GoVersion:”go1.6.3″, Compiler:”gc”, Platform:”linux/amd64″}
[root@openshift ~]# kubectl config
config modifies kubeconfig files using subcommands like “kubectl config set current-context my-context”

The loading order follows these rules:
1. If the –kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes place.
2. If $KUBECONFIG environment variable is set, then it is used a list of paths (normal path delimitting rules for your system). These paths are merged together. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list.
3. Otherwise, ${HOME}/.kube/config is used and no merging takes place.

Usage:
kubectl config SUBCOMMAND [options]

Available Commands:
current-context Displays the current-context
set Sets an individual value in a kubeconfig file
set-cluster Sets a cluster entry in kubeconfig
set-context Sets a context entry in kubeconfig
set-credentials Sets a user entry in kubeconfig
unset Unsets an individual value in a kubeconfig file
use-context Sets the current-context in a kubeconfig file
view Displays merged kubeconfig settings or a specified kubeconfig file.

Use “kubectl <command> –help” for more information about a given command.
Use “kubectl options” for a list of global command-line options (applies to all commands).
[root@openshift ~]# kubectl config view
apiVersion: v1
clusters:
– cluster:
certificate-authority-data: REDACTED
server: https://10.128.0.3:8443
name: 10-128-0-3:8443
– cluster:
certificate-authority-data: REDACTED
server: https://146.148.36.62:8443
name: 146-148-36-62:8443
contexts:
– context:
cluster: 10-128-0-3:8443
namespace: default
user: system:admin/10-128-0-3:8443
name: default/10-128-0-3:8443/system:admin
– context:
cluster: 146-148-36-62:8443
namespace: default
user: system:admin/10-128-0-3:8443
name: default/146-148-36-62:8443/system:admin
– context:
cluster: 10-128-0-3:8443
namespace: kube-system
user: system:admin/10-128-0-3:8443
name: kube-system/10-128-0-3:8443/system:admin
– context:
cluster: 10-128-0-3:8443
namespace: openshift
user: system:admin/10-128-0-3:8443
name: openshift/10-128-0-3:8443/system:admin
current-context: openshift/10-128-0-3:8443/system:admin
kind: Config
preferences: {}
users:
– name: system:admin/10-128-0-3:8443
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
[root@openshift ~]# kubectl explain pods
DESCRIPTION:
Pod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.

FIELDS:
kind <string>
Kind is a string value representing the REST resource this object
represents. Servers may infer this from the endpoint the client submits
requests to. Cannot be updated. In CamelCase. More info:
http://releases.k8s.io/release-1.3/docs/devel/api-conventions.md#types-kinds

metadata <Object>
Standard object’s metadata. More info:
http://releases.k8s.io/release-1.3/docs/devel/api-conventions.md#metadata

spec <Object>
Specification of the desired behavior of the pod. More info:
http://releases.k8s.io/release-1.3/docs/devel/api-conventions.md#spec-and-status

status <Object>
Most recently observed status of the pod. This data may not be up to date.
Populated by the system. Read-only. More info:
http://releases.k8s.io/release-1.3/docs/devel/api-conventions.md#spec-and-status

apiVersion <string>
APIVersion defines the versioned schema of this representation of an
object. Servers should convert recognized schemas to the latest internal
value, and may reject unrecognized values. More info:
http://releases.k8s.io/release-1.3/docs/devel/api-conventions.md#resources

———————————
[root@openshift ~]# kubectl config view
apiVersion: v1
clusters:
– cluster:
certificate-authority-data: REDACTED
server: https://10.128.0.3:8443
name: 10-128-0-3:8443
– cluster:
certificate-authority-data: REDACTED
server: https://146.148.36.62:8443
name: 146-148-36-62:8443
contexts:
– context:
cluster: 10-128-0-3:8443
namespace: default
user: system:admin/10-128-0-3:8443
name: default/10-128-0-3:8443/system:admin
– context:
cluster: 146-148-36-62:8443
namespace: default
user: system:admin/10-128-0-3:8443
name: default/146-148-36-62:8443/system:admin
– context:
cluster: 10-128-0-3:8443
namespace: kube-system
user: system:admin/10-128-0-3:8443
name: kube-system/10-128-0-3:8443/system:admin
– context:
cluster: 10-128-0-3:8443
namespace: openshift
user: system:admin/10-128-0-3:8443
name: openshift/10-128-0-3:8443/system:admin
current-context: openshift/10-128-0-3:8443/system:admin
kind: Config
preferences: {}
users:
– name: system:admin/10-128-0-3:8443
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
——————————————

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s