openshift with vagrant

https://app.vagrantup.com/openshift/boxes/origin-all-in-one

mohammedrafi@NOC-RAFI:~$ mkdir openshift

mohammedrafi@NOC-RAFI:~$ cd openshift/

mohammedrafi@NOC-RAFI:~/openshift$ vagrant init openshift/origin-all-in-one
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

mohammedrafi@NOC-RAFI:~/openshift$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The “2” in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don’t change it unless you know what
# you’re doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = “openshift/origin-all-in-one”

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing “localhost:8080” will access port 80 on the guest machine.
# config.vm.network “forwarded_port”, guest: 80, host: 8080

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network “private_network”, ip: “192.168.33.10”

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network “public_network”

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder “../data”, “/vagrant_data”

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider “virtualbox” do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = “1024”
# end
#
# View the documentation for the provider you are using for more
# information on available options.

# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define “atlas” do |push|
# push.app = “YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME”
# end

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision “shell”, inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end

mohammedrafi@NOC-RAFI:~/openshift$ vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Box ‘openshift/origin-all-in-one’ could not be found. Attempting to find and install…
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box ‘openshift/origin-all-in-one’
default: URL: https://atlas.hashicorp.com/openshift/origin-all-in-one
==> default: Adding box ‘openshift/origin-all-in-one’ (v1.3.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/openshift/boxes/origin-all-in-one/versions/1.3.0/providers/virtualbox.box
==> default: Successfully added box ‘openshift/origin-all-in-one’ (v1.3.0) for ‘virtualbox’!
==> default: Importing base box ‘openshift/origin-all-in-one’…
==> default: Matching MAC address for NAT networking…
==> default: Checking if box ‘openshift/origin-all-in-one’ is up to date…
==> default: Setting the name of the VM: openshift-origin
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports…
default: 8443 (guest) => 8443 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying…
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it’s present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM…
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Configuring and enabling network interfaces…
==> default: Running provisioner: shell…
default: Running: inline script
==> default:
==> default: Successfully started and provisioned VM with 2 cores and 5 G of memory.
==> default: To modify the number of cores and/or available memory modify your local Vagrantfile
==> default:
==> default: You can now access the OpenShift console on: https://10.2.2.2:8443/console
==> default:
==> default: Configured users are (<username>/<password>):
==> default: admin/admin
==> default: user/user
==> default: But, you can also use any username and password combination you would like to create
==> default: a new user.
==> default:
==> default: You can find links to the client libraries here: https://www.openshift.org/vm
==> default: If you have the oc client library on your host, you can also login from your host.
==> default:
==> default: To use OpenShift CLI, run:
==> default: $ oc login https://10.2.2.2:8443

mohammedrafi@NOC-RAFI:~/openshift$ vagrant ssh
Last login: Fri Sep 23 18:35:22 2016 from 10.0.2.2

[vagrant@localhost ~]$ sudo -i

[root@localhost ~]# update-ca-trust extract

[root@localhost ~]# yum install net-tools -y

[root@localhost ~]# 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 3702/haproxy
tcp 0 0 127.0.0.1:10444 0.0.0.0:* LISTEN 3702/haproxy
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1001/rpcbind
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3702/haproxy
tcp 0 0 0.0.0.0:1936 0.0.0.0:* LISTEN 3702/haproxy
tcp 0 0 0.0.0.0:20048 0.0.0.0:* LISTEN 1027/rpc.mountd
tcp 0 0 10.2.2.2:53 0.0.0.0:* LISTEN 985/openshift
tcp 0 0 0.0.0.0:8053 0.0.0.0:* LISTEN 985/openshift
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 984/sshd
tcp 0 0 0.0.0.0:41720 0.0.0.0:* LISTEN –
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2183/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3702/haproxy
tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 985/openshift
tcp 0 0 0.0.0.0:41886 0.0.0.0:* LISTEN 997/rpc.statd
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN –
tcp6 0 0 :::10250 :::* LISTEN 985/openshift
tcp6 0 0 :::47918 :::* LISTEN 997/rpc.statd
tcp6 0 0 :::111 :::* LISTEN 1001/rpcbind
tcp6 0 0 :::20048 :::* LISTEN 1027/rpc.mountd
tcp6 0 0 :::22 :::* LISTEN 984/sshd
tcp6 0 0 :::7001 :::* LISTEN 985/openshift
tcp6 0 0 :::4001 :::* LISTEN 985/openshift
tcp6 0 0 :::2049 :::* LISTEN –
tcp6 0 0 :::33475 :::* LISTEN –

 

 

This slideshow requires JavaScript.

[root@localhost ~]# oc whoami
system:admin

[root@localhost ~]# oc get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE
docker-registry-1-i37wn 1/1 Running 3 1y 172.17.0.5 origin
router-1-fn5kw 1/1 Running 3 1y 10.0.2.15 origin

[root@localhost ~]# oc get nodes
NAME STATUS AGE
origin Ready 1y

[root@localhost ~]# oc get dc
NAME REVISION DESIRED CURRENT TRIGGERED BY
docker-registry 1 1 1 config
router 1 1 1 config

[root@localhost ~]# oc get svc
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
docker-registry 172.30.53.244 <none> 5000/TCP 1y
kubernetes 172.30.0.1 <none> 443/TCP,53/UDP,53/TCP 1y
router 172.30.198.186 <none> 80/TCP,443/TCP,1936/TCP 1y

[root@localhost ~]# oc get project
NAME DISPLAY NAME STATUS
openshift-infra Active
cockpit Active
default Active
kube-system Active
openshift Active

[root@localhost ~]# oc get pv
NAME CAPACITY ACCESSMODES STATUS CLAIM REASON AGE
pv01 10Gi RWO,RWX Available 1y
pv02 10Gi RWO,RWX Available 1y
pv03 10Gi RWO,RWX Available 1y
pv04 10Gi RWO,RWX Available 1y
pv05 10Gi RWO,RWX Available 1y

[root@localhost ~]# oc login -u user
Authentication required for https://10.2.2.2:8443 (openshift)
Username: user
Password:
Login successful.

You don’t have any projects. You can try to create a new project, by running

oc new-project <projectname>

[root@localhost ~]# oc whoami
user

[root@localhost ~]# oc
OpenShift Client

This client helps you develop, build, deploy, and run your applications on any OpenShift or
Kubernetes compatible platform. It also includes the administrative commands for managing a
cluster under the ‘adm’ subcommand.

To create a new application, login to your server and then run new-app:

oc login https://mycluster.mycompany.com
oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git
oc logs -f bc/ruby-ex

This will create an application based on the Docker image ‘centos/ruby-22-centos7’ that builds
the source code from GitHub. A build will start automatically, push the resulting image to the
registry, and a deployment will roll that change out in your project.

Once your application is deployed, use the status, describe, and get commands to see more about
the created components:

oc status
oc describe deploymentconfig ruby-ex
oc get pods

To make this application visible outside of the cluster, use the expose command on the service
we just created to create a ‘route’ (which will connect your application over the HTTP port
to a public domain name).

oc expose svc/ruby-ex
oc status

You should now see the URL the application can be reached at.

To see the full list of commands supported, run ‘oc help’.

[root@localhost ~]# oc –help
OpenShift Client

This client helps you develop, build, deploy, and run your applications on any OpenShift or
Kubernetes compatible platform. It also includes the administrative commands for managing a
cluster under the ‘adm’ subcommand.

Basic Commands:
types An introduction to concepts and types
login Log in to a server
new-project Request a new project
new-app Create a new application
status Show an overview of the current project
project Switch to another project
projects Display existing projects
explain Documentation of resources.
cluster Start and stop OpenShift cluster
idle Idle scalable resources

Build and Deploy Commands:
rollout rollout manages a deployment
deploy View, start, cancel, or retry a deployment
rollback Revert part of an application back to a previous deployment
new-build Create a new build configuration
start-build Start a new build
cancel-build Cancel running, pending, or new builds
import-image Imports images from a Docker registry
tag Tag existing images into image streams

Application Management Commands:
get Display one or many resources
describe Show details of a specific resource or group of resources
edit Edit a resource on the server
set Commands that help set specific features on objects
label Update the labels on a resource
annotate Update the annotations on a resource
expose Expose a replicated application as a service or route
delete Delete one or more resources
scale Change the number of pods in a deployment
autoscale Autoscale a deployment config or replication controller
secrets Manage secrets
serviceaccounts Manage service accounts in your project.

Troubleshooting and Debugging Commands:
logs Print the logs for a resource.
rsh Start a shell session in a pod
rsync Copy files between local filesystem and a pod
port-forward Forward one or more local ports to a pod.
debug Launch a new instance of a pod for debugging
exec Execute a command in a container.
proxy Run a proxy to the Kubernetes API server
attach Attach to a running container.
run Run a particular image on the cluster.

Advanced Commands:
adm Tools for managing a cluster
create Create a resource by filename or stdin
replace Replace a resource by filename or stdin.
apply Apply a configuration to a resource by filename or stdin
patch Update field(s) of a resource using strategic merge patch.
process Process a template into list of resources
export Export resources so they can be used elsewhere
extract Extract secrets or config maps to disk
observe Observe changes to resources and react to them (experimental)
policy Manage authorization policy
convert Convert config files between different API versions
import Commands that import applications

Settings Commands:
logout End the current server session
config Change configuration files for the client
whoami Return information about the current session
completion Output shell completion code for the given shell (bash or zsh)

Other Commands:
help Help about any command
version Display client and server versions

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

[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
00788e6ac436 openshift/origin-metrics-hawkular-metrics:v1.3.0 “/opt/hawkular/script” 13 seconds ago Up 11 seconds k8s_hawkular-metrics.37f0cb47_hawkular-metrics-ns2ij_openshift-infra_10c3a998-81bc-11e6-bb35-525400c583ad_ce7ae584
39780937736f openshift/origin-metrics-heapster:v1.3.0 “heapster-wrapper.sh ” 52 seconds ago Up 50 seconds k8s_heapster.4551c889_heapster-sdr3v_openshift-infra_11c54b5b-81bc-11e6-bb35-525400c583ad_e77883df
bd0b0eb800e4 cockpit/kubernetes “/usr/libexec/cockpit” 3 minutes ago Up 3 minutes k8s_openshift-cockpit.14908408_openshift-cockpit-1-0jub2_cockpit_052ea662-81bc-11e6-bb35-525400c583ad_1f2ae50d
a9a0ff6393cd openshift/origin-pod:v1.3.0 “/pod” 3 minutes ago Up 3 minutes k8s_POD.75ca2cc1_hawkular-metrics-ns2ij_openshift-infra_10c3a998-81bc-11e6-bb35-525400c583ad_c0c6424c
128b540d28ed openshift/origin-haproxy-router:v1.3.0 “/usr/bin/openshift-r” 4 minutes ago Up 3 minutes k8s_router.fdb6f3d1_router-1-fn5kw_default_04dc941b-81bc-11e6-bb35-525400c583ad_4eb733c1
379632748b58 openshift/origin-docker-registry:v1.3.0 “/bin/sh -c ‘DOCKER_R” 4 minutes ago Up 4 minutes k8s_registry.59b7d2b8_docker-registry-1-i37wn_default_0515ec11-81bc-11e6-bb35-525400c583ad_798f3359
689d43ec85a8 openshift/origin-pod:v1.3.0 “/pod” 4 minutes ago Up 4 minutes k8s_POD.4a82dc9f_router-1-fn5kw_default_04dc941b-81bc-11e6-bb35-525400c583ad_dcc670b6
9dcf62fe29df openshift/origin-pod:v1.3.0 “/pod” 4 minutes ago Up 4 minutes k8s_POD.9fa2fe82_docker-registry-1-i37wn_default_0515ec11-81bc-11e6-bb35-525400c583ad_38ad2c86
aded4c5bd656 openshift/origin-pod:v1.3.0 “/pod” 4 minutes ago Up 4 minutes k8s_POD.182903ec_heapster-sdr3v_openshift-infra_11c54b5b-81bc-11e6-bb35-525400c583ad_5c2b1b7c
bb9e1fc3c070 openshift/origin-pod:v1.3.0 “/pod” 4 minutes ago Up 4 minutes k8s_POD.62547583_hawkular-cassandra-1-ihpvd_openshift-infra_11208439-81bc-11e6-bb35-525400c583ad_e2be5b34
08b2758983a5 openshift/origin-pod:v1.3.0 “/pod” 4 minutes ago Up 4 minutes k8s_POD.b858fe8f_openshift-cockpit-1-0jub2_cockpit_052ea662-81bc-11e6-bb35-525400c583ad_681cdee5

[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/cockpit/kubernetes latest e1cd26f1a44c 9 days ago 399.5 MB
docker.io/openshift/origin-deployer v1.3.0 5bf464732ca8 16 months ago 487.1 MB
docker.io/openshift/origin-docker-registry v1.3.0 59d447094a3c 16 months ago 345.5 MB
docker.io/openshift/origin-haproxy-router v1.3.0 e33d4e33dffb 16 months ago 506.2 MB
docker.io/openshift/origin-pod v1.3.0 35873f68181d 16 months ago 1.591 MB
docker.io/openshift/origin-metrics-heapster v1.3.0 3f80c00bdd32 16 months ago 994.8 MB
docker.io/openshift/origin-metrics-deployer v1.3.0 e261ae18fca5 16 months ago 647.2 MB
docker.io/openshift/origin-metrics-cassandra v1.3.0 2a389f0b9ea8 16 months ago 665.6 MB
docker.io/openshift/origin-metrics-hawkular-metrics v1.3.0 cc940d946002 16 months ago 961.7 MB
<none> <none> a0393477373e 17 months ago 245.9 MB

[root@localhost ~]# oc get pods docker-registry-1-i37wn -o json
{
“kind”: “Pod”,
“apiVersion”: “v1”,
“metadata”: {
“name”: “docker-registry-1-i37wn”,
“generateName”: “docker-registry-1-“,
“namespace”: “default”,
“selfLink”: “/api/v1/namespaces/default/pods/docker-registry-1-i37wn”,
“uid”: “0515ec11-81bc-11e6-bb35-525400c583ad”,
“resourceVersion”: “1765”,
“creationTimestamp”: “2016-09-23T18:32:02Z”,
“labels”: {
“deployment”: “docker-registry-1”,
“deploymentconfig”: “docker-registry”,
“docker-registry”: “default”
},
“annotations”: {
“kubernetes.io/created-by”: “{\”kind\”:\”SerializedReference\”,\”apiVersion\”:\”v1\”,\”reference\”:{\”kind\”:\”ReplicationController\”,\”namespace\”:\”default\”,\”name\”:\”docker-registry-1\”,\”uid\”:\”e688a2cd-81bb-11e6-9bab-525400c583ad\”,\”apiVersion\”:\”v1\”,\”resourceVersion\”:\”659\”}}\n”,
“openshift.io/deployment-config.latest-version”: “1”,
“openshift.io/deployment-config.name”: “docker-registry”,
“openshift.io/deployment.name”: “docker-registry-1”,
“openshift.io/scc”: “privileged”
}
},
“spec”: {
“volumes”: [
{
“name”: “registry-storage”,
“hostPath”: {
“path”: “/opt/registry”
}
},
{
“name”: “registry-token-bgv6g”,
“secret”: {
“secretName”: “registry-token-bgv6g”
}
}
],
“containers”: [
{
“name”: “registry”,
“image”: “openshift/origin-docker-registry:v1.3.0”,
“ports”: [
{
“containerPort”: 5000,
“protocol”: “TCP”
}
],
“env”: [
{
“name”: “REGISTRY_HTTP_ADDR”,
“value”: “:5000”
},
{
“name”: “REGISTRY_HTTP_NET”,
“value”: “tcp”
},
{
“name”: “REGISTRY_HTTP_SECRET”,
“value”: “pvX7W1ZfpP1+5cXAd+Mt4YBD/UycQK3WbtY2sya+NCc=”
},
{
“name”: “REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ENFORCEQUOTA”,
“value”: “false”
}
],
“resources”: {
“requests”: {
“cpu”: “100m”,
“memory”: “256Mi”
}
},
“volumeMounts”: [
{
“name”: “registry-storage”,
“mountPath”: “/registry”
},
{
“name”: “registry-token-bgv6g”,
“readOnly”: true,
“mountPath”: “/var/run/secrets/kubernetes.io/serviceaccount”
}
],
“livenessProbe”: {
“httpGet”: {
“path”: “/healthz”,
“port”: 5000,
“scheme”: “HTTP”
},
“initialDelaySeconds”: 10,
“timeoutSeconds”: 5,
“periodSeconds”: 10,
“successThreshold”: 1,
“failureThreshold”: 3
},
“readinessProbe”: {
“httpGet”: {
“path”: “/healthz”,
“port”: 5000,
“scheme”: “HTTP”
},
“timeoutSeconds”: 5,
“periodSeconds”: 10,
“successThreshold”: 1,
“failureThreshold”: 3
},
“terminationMessagePath”: “/dev/termination-log”,
“imagePullPolicy”: “IfNotPresent”,
“securityContext”: {
“privileged”: true
}
}
],
“restartPolicy”: “Always”,
“terminationGracePeriodSeconds”: 30,
“dnsPolicy”: “ClusterFirst”,
“host”: “origin”,
“serviceAccountName”: “registry”,
“serviceAccount”: “registry”,
“nodeName”: “origin”,
“securityContext”: {},
“imagePullSecrets”: [
{
“name”: “registry-dockercfg-mxbfs”
}
]
},
“status”: {
“phase”: “Running”,
“conditions”: [
{
“type”: “Initialized”,
“status”: “True”,
“lastProbeTime”: null,
“lastTransitionTime”: “2016-09-23T18:32:02Z”
},
{
“type”: “Ready”,
“status”: “True”,
“lastProbeTime”: null,
“lastTransitionTime”: “2018-02-02T16:25:58Z”
},
{
“type”: “PodScheduled”,
“status”: “True”,
“lastProbeTime”: null,
“lastTransitionTime”: “2016-09-23T18:32:02Z”
}
],
“hostIP”: “10.0.2.15”,
“podIP”: “172.17.0.5”,
“startTime”: “2016-09-23T18:32:02Z”,
“containerStatuses”: [
{
“name”: “registry”,
“state”: {
“running”: {
“startedAt”: “2018-02-02T16:25:45Z”
}
},
“lastState”: {
“terminated”: {
“exitCode”: 137,
“reason”: “Error”,
“startedAt”: “2018-02-02T16:09:33Z”,
“finishedAt”: “2018-02-02T16:25:24Z”,
“containerID”: “docker://ed91bc8c549c1221da0dc7eff359c168e03b869efe628941b2df34ffc54d943e”
}
},
“ready”: true,
“restartCount”: 3,
“image”: “openshift/origin-docker-registry:v1.3.0”,
“imageID”: “docker://sha256:59d447094a3cfd744802b0a3077721a536f8ec945d019b29ef2f55480096b6ba”,
“containerID”: “docker://379632748b5851325877ae7828f23d5ba7a6fadd674f401f649afd6986884156”
}
]
}
}

[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LogVol00 VolGroup00 -wi-ao—- 37.69g
LogVol01 VolGroup00 -wi-ao—- 1.50g
docker-poolmeta VolGroup00 -wi-a—– 64.00m
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 500M 0 part /boot
└─sda3 8:3 0 39.5G 0 part
├─VolGroup00-LogVol00 253:0 0 37.7G 0 lvm /
├─VolGroup00-LogVol01 253:1 0 1.5G 0 lvm [SWAP]
└─VolGroup00-docker–poolmeta 253:2 0 64M 0 lvm
loop0 7:0 0 30G 0 loop
└─docker-253:0-132297-pool 253:3 0 30G 0 dm
├─docker-253:0-132297-3a5fd2a515f314ed798e6f94f926ffa5d1d9c87b2b15a7c26b869e8bca742ac5 253:4 0 10G 0 dm
├─docker-253:0-132297-534ae5bae1ca58a2605e86e65b3b082db19eb806f50b6a59628140ccb5302c2b 253:5 0 10G 0 dm
├─docker-253:0-132297-1032b18051d4446ba3dd134b5a5ccc886d65a0e541e9d101b63cb69c44ceaf9d 253:6 0 10G 0 dm
├─docker-253:0-132297-8b6065045bd07c3161972213782ee30f3f12b53febd07268bb325a4bbdeae1ed 253:7 0 10G 0 dm
├─docker-253:0-132297-2af4d88c754e2bc8f26056705a36e31ef0a449b715eda15fb03bb8a4eef92b0b 253:8 0 10G 0 dm
├─docker-253:0-132297-826e428ac7edf451f1227689b714cdba98b1bdb86c1997f87a9236389761fc16 253:9 0 10G 0 dm
├─docker-253:0-132297-d6b2a792920736dd64bc43f7b53d6532c6f38c8aa6ee2e4b1580e5ebd133c4c2 253:10 0 10G 0 dm
├─docker-253:0-132297-238370e0b09f854bccb952f7ca927e83295a1108e31a49dac35c14d67c38dd1f 253:11 0 10G 0 dm
├─docker-253:0-132297-e7b974371553440932068c3e039f069a90aa458d7943fbaf528fe42989aa25db 253:13 0 10G 0 dm
├─docker-253:0-132297-a3ab9b01b10513130fea75a4f882dfa3f844a50e40054172aedb6eb00d8fe750 253:14 0 10G 0 dm
└─docker-253:0-132297-dd9707a66786b4e76953e5f3d463598b72241d63ad1bdba2d21a1f9c02404ca1 253:15 0 10G 0 dm
loop1 7:1 0 2G 0 loop
└─docker-253:0-132297-pool 253:3 0 30G 0 dm
├─docker-253:0-132297-3a5fd2a515f314ed798e6f94f926ffa5d1d9c87b2b15a7c26b869e8bca742ac5 253:4 0 10G 0 dm
├─docker-253:0-132297-534ae5bae1ca58a2605e86e65b3b082db19eb806f50b6a59628140ccb5302c2b 253:5 0 10G 0 dm
├─docker-253:0-132297-1032b18051d4446ba3dd134b5a5ccc886d65a0e541e9d101b63cb69c44ceaf9d 253:6 0 10G 0 dm
├─docker-253:0-132297-8b6065045bd07c3161972213782ee30f3f12b53febd07268bb325a4bbdeae1ed 253:7 0 10G 0 dm
├─docker-253:0-132297-2af4d88c754e2bc8f26056705a36e31ef0a449b715eda15fb03bb8a4eef92b0b 253:8 0 10G 0 dm
├─docker-253:0-132297-826e428ac7edf451f1227689b714cdba98b1bdb86c1997f87a9236389761fc16 253:9 0 10G 0 dm
├─docker-253:0-132297-d6b2a792920736dd64bc43f7b53d6532c6f38c8aa6ee2e4b1580e5ebd133c4c2 253:10 0 10G 0 dm
├─docker-253:0-132297-238370e0b09f854bccb952f7ca927e83295a1108e31a49dac35c14d67c38dd1f 253:11 0 10G 0 dm
├─docker-253:0-132297-e7b974371553440932068c3e039f069a90aa458d7943fbaf528fe42989aa25db 253:13 0 10G 0 dm
├─docker-253:0-132297-a3ab9b01b10513130fea75a4f882dfa3f844a50e40054172aedb6eb00d8fe750 253:14 0 10G 0 dm
└─docker-253:0-132297-dd9707a66786b4e76953e5f3d463598b72241d63ad1bdba2d21a1f9c02404ca1 253:15 0 10G 0 dm

[root@localhost ~]# cat /etc/exports

/nfsvolumes/pv01 *(rw,root_squash)
/nfsvolumes/pv02 *(rw,root_squash)
/nfsvolumes/pv03 *(rw,root_squash)
/nfsvolumes/pv04 *(rw,root_squash)
/nfsvolumes/pv05 *(rw,root_squash)

[root@localhost ~]# oc describe pod docker-registry-1-i37wn

[root@localhost ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
docker-registry-1-i37wn 1/1 Running 3 1y
router-1-fn5kw 1/1 Running 3 1y

[root@localhost ~]# kubectl logs router-1-fn5kw
I0202 16:25:59.623568 1 router.go:161] Router is including routes in all namespaces
I0202 16:26:02.500846 1 router.go:404] Router reloaded:
– Checking HAProxy /healthz on port 1936 …
– HAProxy port 1936 health check ok : 0 retry attempt(s).
I0202 16:26:08.756032 1 router.go:404] Router reloaded:
– Checking HAProxy /healthz on port 1936 …
– HAProxy port 1936 health check ok : 0 retry attempt(s).
I0202 16:26:27.072521 1 router.go:404] Router reloaded:
– Checking HAProxy /healthz on port 1936 …
– HAProxy port 1936 health check ok : 0 retry attempt(s).

[root@localhost ~]# kubectl exec router-1-fn5kw -it /bin/bash
id: cannot find name for user ID 1000000000
[I have no name!@localhost conf]$

[root@localhost ~]# oc get users
NAME UID FULL NAME IDENTITIES
admin 3ddbbb13-81bc-11e6-bb35-525400c583ad anypassword:admin

[root@localhost ~]# 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@localhost ~]# kubectl cluster-info
Kubernetes master is running at https://10.2.2.2:8443

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

[root@localhost ~]# kubectl config view
apiVersion: v1
clusters:
– cluster:
certificate-authority-data: REDACTED
server: https://10.2.2.2:8443
name: 10-2-2-2:8443
contexts:
– context:
cluster: 10-2-2-2:8443
namespace: default
user: system:admin/10-2-2-2:8443
name: default/10-2-2-2:8443/system:admin
current-context: default/10-2-2-2:8443/system:admin
kind: Config
preferences: {}
users:
– name: system:admin/10-2-2-2:8443
user:
client-certificate-data: REDACTED
client-key-data: REDACTED

[root@localhost ~]# systemctl status nfs
● nfs-server.service – NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Active: active (exited) since Fri 2018-02-02 16:25:07 UTC; 51min ago
Process: 1512 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 1407 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 1512 (code=exited, status=0/SUCCESS)
Memory: 0B
CGroup: /system.slice/nfs-server.service

Feb 02 16:25:05 localhost.localdomain systemd[1]: Starting NFS server and services…
Feb 02 16:25:07 localhost.localdomain systemd[1]: Started NFS server and services.

[root@localhost ~]# oc project openshift-infra
Already on project “openshift-infra” on server “https://10.2.2.2:8443&#8221;.
[root@localhost ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
hawkular-cassandra-1-ihpvd 0/1 CrashLoopBackOff 25 1y
hawkular-metrics-ns2ij 0/1 Running 20 1y
heapster-sdr3v 0/1 Running 17 1y

[root@localhost ~]# oc –help
OpenShift Client

This client helps you develop, build, deploy, and run your applications on any OpenShift or
Kubernetes compatible platform. It also includes the administrative commands for managing a
cluster under the ‘adm’ subcommand.

Basic Commands:
types An introduction to concepts and types
login Log in to a server
new-project Request a new project
new-app Create a new application
status Show an overview of the current project
project Switch to another project
projects Display existing projects
explain Documentation of resources.
cluster Start and stop OpenShift cluster
idle Idle scalable resources

Build and Deploy Commands:
rollout rollout manages a deployment
deploy View, start, cancel, or retry a deployment
rollback Revert part of an application back to a previous deployment
new-build Create a new build configuration
start-build Start a new build
cancel-build Cancel running, pending, or new builds
import-image Imports images from a Docker registry
tag Tag existing images into image streams

Application Management Commands:
get Display one or many resources
describe Show details of a specific resource or group of resources
edit Edit a resource on the server
set Commands that help set specific features on objects
label Update the labels on a resource
annotate Update the annotations on a resource
expose Expose a replicated application as a service or route
delete Delete one or more resources
scale Change the number of pods in a deployment
autoscale Autoscale a deployment config or replication controller
secrets Manage secrets
serviceaccounts Manage service accounts in your project.

Troubleshooting and Debugging Commands:
logs Print the logs for a resource.
rsh Start a shell session in a pod
rsync Copy files between local filesystem and a pod
port-forward Forward one or more local ports to a pod.
debug Launch a new instance of a pod for debugging
exec Execute a command in a container.
proxy Run a proxy to the Kubernetes API server
attach Attach to a running container.
run Run a particular image on the cluster.

Advanced Commands:
adm Tools for managing a cluster
create Create a resource by filename or stdin
replace Replace a resource by filename or stdin.
apply Apply a configuration to a resource by filename or stdin
patch Update field(s) of a resource using strategic merge patch.
process Process a template into list of resources
export Export resources so they can be used elsewhere
extract Extract secrets or config maps to disk
observe Observe changes to resources and react to them (experimental)
policy Manage authorization policy
convert Convert config files between different API versions
import Commands that import applications

Settings Commands:
logout End the current server session
config Change configuration files for the client
whoami Return information about the current session
completion Output shell completion code for the given shell (bash or zsh)

Other Commands:
help Help about any command
version Display client and server versions

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

Leave a comment