Skip to content

Instantly share code, notes, and snippets.

@praveenkumar
Created March 5, 2019 06:01
Show Gist options
  • Save praveenkumar/4f0b929593563c087bc724b75c83ee40 to your computer and use it in GitHub Desktop.
Save praveenkumar/4f0b929593563c087bc724b75c83ee40 to your computer and use it in GitHub Desktop.
[DONT DELETE] installer related gist and comments.
This gist contain the install related comments.
@praveenkumar
Copy link
Author

Adding worker label to master.

INSTALL_DIR=test

# Destroy an existing cluster and resources
./openshift-install --dir $INSTALL_DIR destroy cluster --log-level debug

# Create the INSTALL_DIR for the installer and copy the install-config
rm -fr $INSTALL_DIR && mkdir $INSTALL_DIR && cp install-config.yaml $INSTALL_DIR

# Create the manifests using the INSTALL_DIR
./openshift-install --dir $INSTALL_DIR create manifests

# Copy the config which removes taint from master
cp 99_master-kubelet-no-taint.yaml $INSTALL_DIR/openshift/

# Edit $INSTALL_DIR/openshift/99_openshift-cluster-api_master-machines-0.yaml and add spec.metadata.labels[node-role.kubernetes.io/worker] ""

# Start the cluster with 10GB memory and 4 CPU create and wait till it finish
export TF_VAR_libvirt_master_memory=10192
export TF_VAR_libvirt_master_vcpu=4
./openshift-install --dir $INSTALL_DIR create cluster

# check the machine from openshift-machine-api namespace.
$ oc get machines -n openshift-machine-api 
NAME                   INSTANCE   STATE   TYPE   REGION   ZONE   AGE
test1-9k6cz-master-0                                             8m1s

$ oc get machine test1-9k6cz-master-0 -oyaml -n openshift-machine-api 
apiVersion: machine.openshift.io/v1beta1
kind: Machine
metadata:
  creationTimestamp: 2019-03-07T08:37:22Z
  finalizers:
  - machine.machine.openshift.io
  generation: 1
  labels:
    machine.openshift.io/cluster-api-cluster: test1-9k6cz
    machine.openshift.io/cluster-api-machine-role: master
    machine.openshift.io/cluster-api-machine-type: master
  name: test1-9k6cz-master-0
  namespace: openshift-machine-api
  resourceVersion: "4590"
  selfLink: /apis/machine.openshift.io/v1beta1/namespaces/openshift-machine-api/machines/test1-9k6cz-master-0
  uid: 3a2453d5-40b4-11e9-a93a-52fdfc072182
spec:
  metadata:
    creationTimestamp: null
    labels:
      node-role.kubernetes.io/worker: ""    ==> This contains the change we made before starting cluster. 
  providerSpec:
    value:
      apiVersion: libvirtproviderconfig.k8s.io/v1alpha1
      autostart: false
      cloudInit: null
      domainMemory: 4096
      domainVcpu: 2
      ignKey: ""
      ignition:
        userDataSecret: master-user-data
      kind: LibvirtMachineProviderConfig
      networkInterfaceAddress: 192.168.126.0/24
      networkInterfaceHostname: ""
      networkInterfaceName: test1-9k6cz
      networkUUID: ""
      uri: qemu+tcp://libvirt.default/system
      volume:
        baseVolumeID: /var/lib/libvirt/images/test1-9k6cz-base
        poolName: default
        volumeName: ""
  versions:
    kubelet: ""

# Check the labels on the Master (This doesn't contain the worker label)
$ oc get nodes --show-labels
NAME                   STATUS   ROLES    AGE   VERSION              LABELS
test1-9k6cz-master-0   Ready    master   21m   v1.12.4+4dd65df23d   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=test1-9k6cz-master-0,node-role.kubernetes.io/master=

# Need to add label manually
$ oc label nodes test1-9k6cz-master-0 node-role.kubernetes.io/worker=
node/test1-9k6cz-master-0 labeled

# Now master have worker label and ingress also scheduled succesfully
$ oc get nodes --show-labels
NAME                   STATUS   ROLES           AGE   VERSION              LABELS
test1-9k6cz-master-0   Ready    master,worker   22m   v1.12.4+4dd65df23d   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=test1-9k6cz-master-0,node-role.kubernetes.io/master=,node-role.kubernetes.io/worker=

@praveenkumar
Copy link
Author

How to debug for a node

$ oc debug node/<node_name>
$ chroot /host /bin/bash

Get the endpoint of a service

$ oc get svc
$ oc get ed <svc_name>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment