# Error: failed to create secret Post "http://localhost:8080/api/v1/namespaces/default/secrets?fieldManager=kubectl-create&fieldValidation=Strict": dial tcp \[::1\]:8080: connect: connection refused

**URL:** <https://discuss.kubernetes.io/t/error-failed-to-create-secret-post-http-localhost-8080-api-v1-namespaces-default-secrets-fieldmanager-kubectl-create-fieldvalidation-strict-dial-tcp-1-connect-connection-refused/26924>\
**Category:** General Discussions\
**Tags:** development\
**Created:** [February 1, 2024, 2:24pm UTC](https://discuss.kubernetes.io/t/error-failed-to-create-secret-post-http-localhost-8080-api-v1-namespaces-default-secrets-fieldmanager-kubectl-create-fieldvalidation-strict-dial-tcp-1-connect-connection-refused/26924 "2024-02-01T14:24:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![estem](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/estem/32/14169_2.png) [@estem](https://discuss.kubernetes.io/u/estem)\
**Post date:** [February 1, 2024, 2:24pm UTC](https://discuss.kubernetes.io/t/error-failed-to-create-secret-post-http-localhost-8080-api-v1-namespaces-default-secrets-fieldmanager-kubectl-create-fieldvalidation-strict-dial-tcp-1-connect-connection-refused/26924/1 "2024-02-01T14:24:29Z")

</div>

Hi,  
I’m trying to create a secret in kubernetes :

```auto
sudo kubectl create secret generic regcred --from-file=.dockerconfigjson=/root/.docker/config.json --type=kubernetes.io/dockerconfigjson

```

then I got this error :

```auto
error: failed to create secret Post "http://localhost:8080/api/v1/namespaces/default/secrets?fieldManager=kubectl-create&fieldValidation=Strict": dial tcp [::1]:8080: connect: connection refused

```

kubectl config view

```auto
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://192.168.1.2:6443
  name: kubernetes
contexts:

```

any one could help pleaes ?
