Open computate opened 2 months ago
I will be working on it this week.
Here are some steps I did to install a PostgreSQL database for testing the VM.
$ sudo yum install -y postgresql-server postgresql-contrib
$ sudo systemctl start postgresql
$ sudo systemctl enable postgresql
$ sudo -u postgres psql
$ create user test password '...';
$ create database test owner test;
$ create table test(pk bigserial primary key, id text unique, val text);
$ postgres=# insert into test(id, val) values('best-linux-flavor', 'rhel9');
INSERT 0 1
$ postgres=# insert into test(id, val) values('best-linux-flavor', 'ubuntu24.04');
ERROR: duplicate key value violates unique constraint "test_id_key"
I added the following template label to my VirtualMachine oc -n virt-test get vm/computate-centos-stream9
for service support for my postgresql server.
spec:
template:
metadata:
labels:
computate-postgres-test: 'true'
Also add exposed ports to the default interface of the VirtualMachine.
spec:
template:
spec:
domain:
devices:
interfaces:
- name: default
masquerade: {}
Specifically add this port:
ports:
- port: 5432
Update your postgresql pg_hba.conf file to allow md5 password access to external users.
sudo vim /var/lib/pgsql/data/pg_hba.conf
host all all 0.0.0.0/0 md5
:wq
Also update your postgresql.conf file listen_addresses.
sudo vim /var/lib/pgsql/data/postgresql.conf
listen_addresses = '*'
:wq
Then restart the postgresql service.
sudo systemctl restart postgresql
apiVersion: v1
kind: Service
metadata:
name: computate-postgres-test
namespace: virt-test
spec:
selector:
computate-postgres-test: 'true'
type: NodePort
ports:
- protocol: TCP
port: 5432
targetPort: 5432
nodePort: 30432
Notes:
The range of valid ports is 30000-32767" for field "spec.ports[0].nodePort".
@jtriley says: AFAIK the ingress controller only runs on ports 80 and 443 so unless you're configuring a route to that service, that's not going to work
@larsks says: A nodeport exposes a service on a port on all the worker nodes. The address computate-postgres-test.apps.ocp-test.nerc.mghpcc.org resolves to the cluster load balancer, not to one of the worker nodes. Your nodeport is probably working; try contacting it on one of the worker node addresses. The problem is that this won't do you much good, because the worker nodes are only VPN accessible. To expose non-http services (or services on ports other than 80/443), we need to either install and configure MetalLB, or configure an external cluster load balancer with kubernetes support.
@joachimweyl we have some questions for the NERC team in a future meeting:
@jtriley, @larsks, @naved001 Based in the conversation today in the NERC meeting, woud you be able to help with the MetalLB configuration?
Here are the steps I think we'll need to take:
ipaddresspool
resource and an l2advertisement
. There's also support for BGP but I am not familiar with it. @jtriley since I am not familiar with how public IPs are allocated in the NERC/Harvard environment we'll need your help here.
@computate please provide an update.
I don't have additional updates here. We'll need to configure MetalLB next.
@jtriley do you have a timeframe on when we could do the first step that @naved001 suggested?
Get an interface configured on the test cluster worker nodes to be on a public network. This means any necessary VLAN configuration and IP assignment.
I would like to enable SSH access on some VMs in the test cluster, and also test exposing non-http services, as well as Sensu monitoring agent on a VM to demonstrate event driven remediation of issues on a virtual machine.
Where I would love to start is actually accessing a VM internally via SSH credentials from Red Hat Ansible Automation Platform deployed in the same namespace as my virtual machines if that is easier to set up and allow. See my aap-controller route in the virt-test namespace.
Actually, I was able to get internal ssh access to VMs working from Ansible Automation Platform in the same namespace by:
For now using port forwarding, see NERC weekly Operation rolling agenda please comment/emoticon a yes