Kompose up username and password authentication

4/10/2020

I'm experimenting with using kompose on k3s to turn the compose file into a K8s file, but when I type kompose up, it asks me to enter a username and password, but I don't know what to write.

The specific output is as follows

# kompose up
INFO We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application. If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead. 

Please enter Username: test
Please enter Password: test
FATA Error while deploying application: Get https://127.0.0.1:6443/api: x509: certificate signed by unknown authority

However, the kompose convert command was successfully executed

I would appreciate it if you could tell me how to solve it?

The kompose version is 1.21.0 (992df58d8), and install it by 'curl and chmod'

The k3s version is v1.17.3+k3s1 (5b17a175), and install it by 'install.sh script'

OS is Ubuntu18.04.3 TLS

-- moluzhui
authorization
k3s
kompose
kubernetes

1 Answer

4/13/2020

I seem to have found my problem, because I use k3s the install.sh scripts installed by default, it will k8s configuration file stored in the /etc/rancher/k3s/k3s.yaml instead of k8s ~/.Kube/config.

This caused kompose up to fail to obtain certs.

You can use the /etc/rancher/k3s/k3s.yaml copied to ~/.Kube/config.

cp /etc/rancher/k3s/k3s.yaml ~/.kube/config

Then kompose up executes successfully.

-- moluzhui
Source: StackOverflow