Skip to content

Instantly share code, notes, and snippets.

View bysnupy's full-sized avatar
🦉
Dry eyes ...

Daein Park bysnupy

🦉
Dry eyes ...
View GitHub Profile
// Access test for running two web servers on the different network each other.
node ~# ip netns exec 719aa0a6-f1e1-4385-a42b-13f652de99ef curl 192.168.8.10:8080
Running Web Server, IP is 192.168.8.10

node ~# ip netns exec 719aa0a6-f1e1-4385-a42b-13f652de99ef curl 192.168.9.10:8080
Running Web Server, IP is 192.168.9.10
// net1 and net2 has been added with specified IP addresses using annotations.
node ~# ip netns exec 719aa0a6-f1e1-4385-a42b-13f652de99ef ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
3: eth0@if698: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UP group default  link-netnsid 0
    inet 10.128.2.193/23 brd 10.128.3.255 scope global eth0
       valid_lft forever preferred_lft forever
4: net1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default 
$ oc create -n test-ipvlan -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
  annotations:
    k8s.v1.cni.cncf.io/networks: '[
      {
        "name": "net1", 
 "ips": ["192.168.12.80/24"]
// Create test-ipvlan namespace before adding networks.
$ oc new-project test-ipvlan

$ oc edit networks.operator.openshift.io cluster
apiVersion: operator.openshift.io/v1
kind: Network
metadata:
  name: cluster
spec:
user2@bastion ~$ openshift-install wait-for install-complete --log-level debug
INFO Install complete!                            
INFO To access the cluster as the system:admin user when using 'oc', run 'export KUBECONFIG=/root/clusters/ocp46rt/install_dir/auth/kubeconfig' 
INFO Access the OpenShift web-console here: https://console-openshift-console.apps.ocp46rt.example.com 
INFO Login to the console with user: "kubeadmin", and password: "..." 
INFO Time elapsed: 0s 
user2@bastion ~$ oc get clusteroperators
NAME                                       VERSION   AVAILABLE   PROGRESSING   DEGRADED   SINCE
authentication                             4.6.1     True        False         False      89s
cloud-credential                           4.6.1     True        False         False      4h49m
cluster-autoscaler                         4.6.1     True        False         False      179m
config-operator                            4.6.1     True        False         False      3h
console                                    4.6.1     True        False         False      64s
csi-snapshot-controller                    4.6.1     True        False         False      179m
dns                                        4.6.1     True        False         False      178m
user2@bastion ~$ oc patch configs.imageregistry.operator.openshift.io cluster \
                 --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
user2@bastion ~$ oc patch configs.imageregistry.operator.openshift.io cluster \
                 --type merge --patch '{"spec":{"managementState":"Managed"}}'
user2@bastion ~$ oc get csr | grep Pending
csr-8zz9h   5m31s   kubernetes.io/kube-apiserver-client-kubelet   system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending
csr-ltb9x   8m23s   kubernetes.io/kube-apiserver-client-kubelet   system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending
csr-nh6v6   75s     kubernetes.io/kube-apiserver-client-kubelet   system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending

user2@bastion ~$ oc get csr -o name | xargs oc adm certificate approve
:

user2@bastion ~$ oc get node
$ sudo nmcli con mod "Wired Connection" ipv4.method manual \
  ipv4.addresses 192.168.9.xx/24 ipv4.gateway 192.168.9.10 \
  ipv4.dns 192.168.9.10
$ sudo nmcli con down "Wired Connection"
$ sudo nmcli con up   "Wired Connection"
$ sudo nmcli general hostname master1.ocp46rt.priv.local
$ sudo coreos-installer install /dev/sda \
  --ignition-url=http://192.168.9.10:8080/ocp46rt/ign/master.ign \
 --insecure-ignition \
user2@bastion ~$ openshift-install version
openshift-install 4.6.1
:

user2@bastion ~$ openshift-install create manifests --dir install_dir
INFO Consuming Install Config from target directory 
WARNING Making control-plane schedulable by setting MastersSchedulable to true for Scheduler cluster settings 
INFO Manifests created in: install_dir/manifests and install_dir/openshift