Unable to set gcloud project in wsl2 ubuntu - gcloud

I am using Cisco anyconnect vpn, wsl2, Ubuntu 20.04 LTS and I have a problem with setting up my gcloud project.
gcloud config set project my_project
There is no issue with my Windows CMD, so there is no issue with my account. I am able to curl google.com in my wsl2 as well so there is no DNS issue, I mean have the network in my wsl.
I am not sure what privilege I don't have in my wsl2 that caused the system stuck.
In addition, I tried to use an alternative way to set the project and run the
gcloud container clusters ....
but I am not able to run this command as well.
I don't have any issue with the below commands either, which I am running before the above first statement:
gcloud auth activate-service-account --key-file $HOME/mydevdetails.json
gcloud config set account my-dev#dev-server.iam.gserviceaccount.com
Would you mind helping me to figure out what is missing?

I am living in Germany and I am using Vodafone CGA644VF modem which is providing a horrible service for me. It seems that there is some restriction in this type of modem and the problem is due to the size of the packet.
I solve my problem by decreasing the size of the packet sent from WSL by using the below command:
sudo ifconfig eth0 mtu 500 up
You can check your current setting by :
ifconfig | grep mtu

Related

GCloud auth login: Ports 8085 and 8184 possible blocked

I have installed and uninstalled and reinstalled GCloud on MACOS Monterey (Chipset M1) and I'm facing the next situation: When I run in Terminal gcloud auth login, it displays the next message:
WARNING: Failed to start a local webserver listening on any port between 8085 and 8184. Please check your firewall settings or locally running programs that may be blocking or using those ports.
WARNING: Defaulting to --no-browser mode.
You are authorizing gcloud CLI without access to a web browser. Please run the following command on a machine with a web browser and copy its output back here. Make sure the installed gcloud version is 372.0.0 or newer.
I have tried in many ways to install: The last one was this:
curl https://sdk.cloud.google.com | bash
exec -l $SHELL #restart shell
But I still facing that message.
Anybody couls help me with this?
This happens because my Internet provider has blocked these ports. There will be to make some fixes to the router.
Patch solution for this:
gcloud auth login --no-launch-browser
Follow the instructions given on Terminal

VSCode devcontainer connect to kubernetes cluster on vm

Ultimate Goal
From a dotnet/core/sdk devcontainer (using VSCode Remote Containers), debug a .NET Core app running in a kubernetes cluster hosted on another vm of my host machine.
Current Setup
Docker Desktop for Windows running via Hyper-V
default DockerNAT network adapter
Ubuntu VM (multipass) running on same Hyper-V host
microk8s cluster running on this ubuntu instance
default "Default Switch" network adapter
Errors
When I try to ping the ubuntu vm from a docker container by hostname, the IP is resolved properly but I get the error "Destination Host Unreachable"
When I try to curl the cluster api, I get the error "No route to host"
I put this problem aside for a week, and over that time the host has been rebooted multiple times, but no further modifications were made to the networking, Hyper-V setup, etc.
Starting the Ubuntu VM today, the IP changed from what used to be 172.?.?.? to 192.168.92.x . I do not know what caused this change.
Now, Docker Desktop containers can ping the Ubuntu VM and curl the microk8s /api endpoint. Until such a time that I can reproduce the issue, I will mark this question as "solved" and reopen and try Nick's recommended solution if the issue returns.

Kubernetes ssh into nodes not working in local

How to ssh to the node inside the cluster in local. I am using docker edge version which has kubernetes inbuilt. If i run
kubectl ssh node
I am getting
Error: unknown command "ssh" for "kubectl"
Did you mean this?
set
Run 'kubectl --help' for usage.
error: unknown command "ssh" for "kubectl"
Did you mean this?
set
There is no "ssh" command in kubectl yet, but there are plenty of options to access Kubernetes node shell.
In case you are using cloud provider, you are able to connect to nodes directly from instances management interface.
For example, in GCP: Select Menu -> Compute Engine -> VM instances, then press SSH button on the left side of the desired node instance.
In case of using local VM (VMWare, Virtualbox), you can configure sshd before rolling out Kubernetes cluster, or use VM console, which is available from management GUI.
Vagrant provides its own command to access VMs - vagrant ssh
In case of using minikube, there is minikube ssh command to connect to minikube VM. There are also other options.
I found no simple way to access docker-for-desktop VM, but you can easily switch to minikube for experimenting with node settings.
How to ssh to the node inside the cluster in local
Kubernetes is aware of nodes on level of secure communication with kubelets on nodes (geting hostname and ip from node), and as such, does not provide cluster-level ssh to nodes out of the box. Depending on your actual provide/setup there are different ways of connecting to nodes and they all boil down to locate your ssh key, open appropriate ports on firewall/security groups and issue ssh -i key user#node_instance_ip command to access node. If you are running locally with virtual machines you can setup your own ssh keypairs and do the trick..
You can effectively shell into a pod using exec(I know its not exactly what the question asks, but might be helpful).
An example usage would be kubectl exec -it name-of-your-pod -- /bin/bash. assuming you have bash installed.
Hope that helps.
You have to first Extend kubectl with plugins adding https://github.com/luksa/kubectl-plugins.
Basically, to "install" ssh, e.g.:
wget https://raw.githubusercontent.com/luksa/kubectl-plugins/master/kubectl-ssh
Then make sure the file is in kubectl-ssh your path.

Oracle VirtualBox VM network not working

I am attempting to set up a VM using VirtualBox. I am hosting on Windows 10 and want to set up a CentOS vm. I have a VM running but have had problems getting network connectivity with it. I have no experience with VirtualBox and it has been a long time since I worked on Linux. Any ideas on what I need to do to correct this? Are there some steps I need to take during the creation of the image?
Image is : CentOS-7-x86_64-Everything-1708.iso
VirtualBox : Version 5.1.28 r117968 (Qt5.6.2)
When I try to ping anything I get " connection the Network is unreachable
The very best thing you should do is running the following command:
ifconfig -a
Then, If you have an interface listed (not just 'lo'), you can do that:
# cd /etc/sysconfig/network-scripts/
# sed -i -e 's#^ONBOOT="no#ONBOOT="yes#' ifcfg-{{network_device}}
replace {{network_device}} for your default network_device (from ifconfig-a command).
Then restart and it should connect.

virsh list command not showing any domain

I am running Ubuntu 12.04 on a VM on Fedora 18 host using QEMU/KVM and libvirtd. Now, when I fire up the virsh and give list command, it doesn't show any domain running, though my VM is running quite fine. Any idea what am I doing wrong?
It may caused by the user you issued the virsh command. It's normal that you start your VM by sudo but you can see nothing under your other accounts.
You can see your VMs via sudo virsh list --all