Posts

Showing posts with the label port

To get a random available port in your *nix-based machine

For example, If I want to get a random port from the 3000-3999 port pool, I would run the following command in the terminal: comm -23 <(seq 3000 3999 | sort) <(ss -tan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1

How to open a custom port on the istio-ingressgateway

By default, when you deploy istio on a Kubernetes cluster, it will create a load balancer name istio-ingressgateway [1]. That ingress gateway is a Kubernetes's LoadBalancer resource that helps handling incoming traffic into the mesh. You can check by running this command: kubectl -n istio-system get service istio-ingressgateway The istio-ingressgateway load balancer will open a number of ports such as 80, 443, etc. If you want to open a new port on the load balancer, you can do like the following: 1. Export the current configuration of the istio-ingressgateway kubectl -n istio-system get service istio-ingressgateway -o yaml > istio_ingressgateway.yaml 2. Edit the istio_ingressgateway.yaml, add the new port you want, for example nano istio_ingressgateway.yaml ...   - name: myport     nodePort: 31410     port: 5000     protocol: TCP     targetPort: 5000 ... 3. Apply the new configuration kubectl apply -f istio_ingress...

How to delete a port with fixed IP address on an OpenStack Pike instance (deployed by Kolla-Ansible)

You cannot delete a network from the dashboard interface if it's attached to a port with fixed IP address on OpenStack (I'm running Pike). So what you have to do is to delete the port directly from the database: 1. Go to the mariadb docker instance: $ docker exec -it <id or name of the nova docker instance> /bin/bash 2. Login to mariadb console using the password in /etc/kolla/passwords.yml $ mysql -u root -p 3. Run these commands to delete the port (you may need to delete all of its relationship, for example from sfc_flow_classifiers table first) use neutron; select id from sfc_flow_classifiers; # get the id of the classifier that linked to the port delete from sfc_flow_classifiers where id='<the id you get from the previous command>'; delete from ports where id='<the port id you get from the dashboard>'; 4. Then you can delete the network.