Deploying kong with helm - Kong env config file fails

Hi.

When trying to deploy Kong from helm and setting plugins and lua_package_path in the values.yaml under env: section I get the following error:

  • helm_release.kong: rpc error: code = Unknown desc = Job.batch “kong-kong-init-migrations” is invalid: spec.template: Invalid value: core.PodTemplateSpec{ObjectMeta:v1.ObjectMeta{Name:“kong-init-migrations”, GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{“controller-uid”:“UID”, “job-name”:“kong-kong-init-migrations”, “release”:“kong”, “app”:“kong”, “component”:“init-migrations”}, Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:""}, Spec:core.PodSpec{Volumes:[]core.Volume(nil), InitContainers:[]core.Container(nil), Containers:[]core.Container{core.Container{Name:“kong-migrations”, Image:“kong:1.2”, Command:[]string{"/bin/sh", “-c”, “kong migrations bootstrap”}, Args:[]string(nil), WorkingDir:"", Ports:[]core.ContainerPort(nil), EnvFrom:[]core.EnvFromSource(nil), Env:[]core.EnvVar{core.EnvVar{Name:“KONG_NGINX_DAEMON”, Value:“off”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_ADMIN_ACCESS_LOG”, Value:"/dev/stdout", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_ADMIN_ERROR_LOG”, Value:"/dev/stderr", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_ADMIN_GUI_ACCESS_LOG”, Value:"/dev/stdout", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_ADMIN_GUI_ERROR_LOG”, Value:"/dev/stderr", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_DATABASE”, Value:“postgres”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PG_DATABASE”, Value:“kong”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PG_HOST”, Value:“xxxxxxx”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PG_PASSWORD”, Value:“xxxxxxxx”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PG_SSL”, Value:“true”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PG_SSL_VERIFY”, Value:“false”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PG_USER”, Value:“xxxxxxxxx”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PLUGINS”, Value:“bundled”, ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PORTAL_API_ACCESS_LOG”, Value:"/dev/stdout", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PORTAL_API_ERROR_LOG”, Value:"/dev/stderr", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PROXY_ACCESS_LOG”, Value:"/dev/stdout", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:“KONG_PROXY_ERROR_LOG”, Value:"/dev/stderr", ValueFrom:(*core.EnvVarSource)(nil)}}, Resources:core.ResourceRequirements{Limits:core.ResourceList(nil), Requests:core.ResourceList(nil)}, VolumeMounts:[]core.VolumeMount(nil), VolumeDevices:[]core.VolumeDevice(nil), LivenessProbe:(*core.Probe)(nil), ReadinessProbe:(*core.Probe)(nil), Lifecycle:(*core.Lifecycle)(nil), TerminationMessagePath:"/dev/termination-log", TerminationMessagePolicy:“File”, ImagePullPolicy:“IfNotPresent”, SecurityContext:(*core.SecurityContext)(nil), Stdin:false, StdinOnce:false, TTY:false}}, RestartPolicy:“OnFailure”, TerminationGracePeriodSeconds:(*int64)(0xc01b0e9910), ActiveDeadlineSeconds:(*int64)(nil), DNSPolicy:“ClusterFirst”, NodeSelector:map[string]string(nil), ServiceAccountName:"", AutomountServiceAccountToken:(*bool)(nil), NodeName:"", SecurityContext:(*core.PodSecurityContext)(0xc01ac76af0), ImagePullSecrets:[]core.LocalObjectReference(nil), Hostname:"", Subdomain:"", Affinity:(*core.Affinity)(nil), SchedulerName:“default-scheduler”, Tolerations:[]core.Toleration(nil), HostAliases:[]core.HostAlias(nil), PriorityClassName:"", Priority:(*int32)(nil), DNSConfig:(*core.PodDNSConfig)(nil), ReadinessGates:[]core.PodReadinessGate(nil), RuntimeClassName:(*string)(nil), EnableServiceLinks:(*bool)(nil)}}: field is immutable

My values.yaml looks like this:

Specify Kong configurations

Kong configurations guide https://getkong.org/docs/latest/configuration/

env:
database: “{postgresql_db}" pg_host: "{postgresql_host}”
pg_user: “{postgresql_user}" pg_database: "{postgresql_database}”
pg_password: “${postgresql_password}”
pg_ssl: on
pg_ssl_verify: off
proxy_access_log: /dev/stdout
admin_access_log: /dev/stdout
admin_gui_access_log: /dev/stdout
portal_api_access_log: /dev/stdout
proxy_error_log: /dev/stderr
admin_error_log: /dev/stderr
admin_gui_error_log: /dev/stderr
portal_api_error_log: /dev/stderr
plugins: bundled
lua_package_path: ./?.lua;./?/init.lua;./plugins/?.lua;;

It seems like you previously had a migration job already in the same namespace of the same cluster.
You will have to delete that first before you install it back again.

Ahh, thanks for the help.

can I disable migration job,when helm upgrade?

Yes, set runMigrations to false: