"How to fix 'Error: must either provide a name or specify --generate-name' in Helm"

According to the helm documentation for v3.x

helm install --help
Usage:
helm install [NAME] [CHART] [flags]

you want to use:
helm install "your release name" chart

For example:

# helm repo add stable https://kubernetes-charts.storage.googleapis.com/
# helm install wordpress-helm-testing stable/wordpress 
NAME: wordpress-helm-testing
LAST DEPLOYED: 2019-10-07 15:56:21.205156 -0700 PDT m=+1.763748029
NAMESPACE: default
STATUS: deployed
NOTES:
1. Get the WordPress URL:

  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        Watch the status with: 'kubectl get svc --namespace default -w wordpress-helm-testing'
  export SERVICE_IP=$(kubectl get svc --namespace default wordpress-helm-testing --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
  echo "WordPress URL: http://$SERVICE_IP/"
  echo "WordPress Admin URL: http://$SERVICE_IP/admin"

2. Login with the following credentials to see your blog

  echo Username: user
  echo Password: $(kubectl get secret --namespace default wordpress-helm-testing -o jsonpath="{.data.wordpress-password}" | base64 --decode)


#helm list
NAME                    NAMESPACE   REVISION    UPDATED                                 STATUS      CHART          
wordpress-helm-testing  default     1           2019-10-07 15:56:21.205156 -0700 PDT    deployed    wordpress-7.3.9

This is a better operational approach since it eliminates randomness in your release names. You might want to use something like a user name or anything that makes it unique and adds meaning to the release other than the GUID the --generate-name option will give you.


just to add --generate-name at the end of helm command


In helm v3 you can use either:

helm install [NAME] [CHART]

or:

helm install [CHART] --generate-name

Examples:

helm install reloader stakater/reloader
helm install stakater/reloader --generate-name

From the help manual:

helm install --help
Usage:
  helm install [NAME] [CHART] [flags]
Flags:
  -g, --generate-name            generate the name (and omit the NAME parameter)