Dotnet Core 5.0 - Trouble with design time migrations - entity-framework

I have a DbContext that I am using to create a design time migration however I am having trouble.
I have a "Migractions" class (Below) that is essentially a Designtime factory as per this answer.
No errors and it builds.
I have placed this class in the web project and the context is in another project library.
I run the migration using the following:
dotnet ef migrations add INITIAL --context TENANTSContext -s ../Jobsledger.API
Once it runs it builds and then the following displays:
Build started...
Build succeeded.
An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: JobsLedger.DATABASE.CREATION.SERVICE.IDatabaseCreationService Lifetime: Scoped ImplementationType: JobsLedger.DATABASE.CREATION.SERVICE.DatabaseCreationService': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATABASE.CREATION.SERVICE.Interfaces.INewDatabaseService Lifetime: Scoped ImplementationType: JobsLedger.DATABASE.CREATION.SERVICE.NewDatabaseService': Unable to resolve service for type 'JobsLedger.TENANTS.Repositories.Interfaces.IAccountTENANTSRepository' while attempting to activate 'JobsLedger.DATABASE.CREATION.SERVICE.NewDatabaseService'.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATABASE.CREATION.SERVICE.Interfaces.ITenantAndAccountInitialisations Lifetime: Scoped ImplementationType: JobsLedger.DATABASE.CREATION.SERVICE.TenantAndAccountInitialisations': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.TENANTS.TENANTSContext Lifetime: Scoped ImplementationType: JobsLedger.TENANTS.TENANTSContext': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.DATAContext Lifetime: Scoped ImplementationType: JobsLedger.DATA.DATAContext': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.IBrandDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.BrandDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.IClientDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.ClientDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.ICounterDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.CounterDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.IJobDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.JobDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.ILoggingDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.LoggingDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.INoteDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.NoteDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.INoteTypeDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.NoteTypeDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.IStateDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.StateDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.IStatusDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.StatusDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.ISuburbDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.SuburbDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.ITypeDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.TypeDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATA.Repositories.Interfaces.IVisitDATARepository Lifetime: Scoped ImplementationType: JobsLedger.DATA.Repositories.VisitDATARepository': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.TENANTS.Repositories.Interfaces.ITenantTENANTSRepository Lifetime: Scoped ImplementationType: JobsLedger.TENANTS.Repositories.TenantTENANTSRepository': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.TENANTS.Repositories.Interfaces.ITenantTENANTSRepository Lifetime: Scoped ImplementationType: JobsLedger.TENANTS.Repositories.TenantTENANTSRepository': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.TENANTS.Repositories.Interfaces.ICounterTENANTSRepository Lifetime: Scoped ImplementationType: JobsLedger.TENANTS.Repositories.CounterTENANTSRepository': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.TENANTS.Repositories.Interfaces.ISuburbTENANTSRepository Lifetime: Scoped ImplementationType: JobsLedger.TENANTS.Repositories.SuburbTENANTSRepository': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.TENANTS.Repositories.Interfaces.IStateTENANTSRepository Lifetime: Scoped ImplementationType: JobsLedger.TENANTS.Repositories.StateTENANTSRepository': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.API.CONTROLLER.SERVICES.API.App.ClientService.Interfaces.IClientServices Lifetime: Scoped ImplementationType: JobsLedger.API.CONTROLLER.SERVICES.API.App.ClientService.ClientServices': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.API.CONTROLLER.SERVICES.API.App.JobService.Interfaces.IJobServices Lifetime: Scoped ImplementationType: JobsLedger.API.CONTROLLER.SERVICES.API.App.JobService.JobServices': No constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated using services from the service container and default values.) (Error while validating the service descriptor 'ServiceType: JobsLedger.API.CONTROLLER.SERVICES.Authorisation.Interfaces.IAccountService Lifetime: Scoped ImplementationType: JobsLedger.API.CONTROLLER.SERVICES.Authorisation.AccountService': Unable to resolve service for type 'JobsLedger.TENANTS.Repositories.Interfaces.IAccountTENANTSRepository' while attempting to activate 'JobsLedger.API.CONTROLLER.SERVICES.Authorisation.AccountService'.) (Error while validating the service descriptor 'ServiceType: JobsLedger.API.CONTROLLER.SERVICES.Common.Interfaces.IAddressDropdownServices Lifetime: Scoped ImplementationType: JobsLedger.API.CONTROLLER.SERVICES.Common.AddressDropdownServices': Unable to resolve service for type 'JobsLedger.INTERFACES.IUserSession' while attempting to activate 'JobsLedger.API.CONTROLLER.SERVICES.Common.AddressDropdownServices'.) (Error while validating the service descriptor 'ServiceType: JobsLedger.DATABASE.CREATION.SERVICE.Interfaces.ITenantAndAccountInitialisations Lifetime: Scoped ImplementationType: JobsLedger.DATABASE.CREATION.SERVICE.TenantAndAccountInitialisations': No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services from the service container and default values.)
System.MissingMethodException: No parameterless constructor defined for type 'JobsLedger.API.DesignTimeTENANTSContextFactory'.
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContextFromFactory(Type factory, Type contextType)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.<>c__DisplayClass13_2.<FindContextTypes>b__9()
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func`1 factory)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType, String namespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType, String namespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigration.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
No parameterless constructor defined for type 'JobsLedger.API.DesignTimeTENANTSContextFactory'.
The first part of that error is detailed again below and says ALL scoped services cannot be resolved - these are essentially a list of all services for the DI in my startup:
An error occurred while accessing the Microsoft.Extensions.Hosting
services. Continuing without the application service provider. Error:
Some services are not able to be constructed (Error while validating
the service descriptor 'ServiceType:
JobsLedger.DATABASE.CREATION.SERVICE.IDatabaseCreationService
Lifetime: Scoped ImplementationType:
JobsLedger.DATABASE.CREATION.SERVICE.DatabaseCreationService': No
constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.DATABASE.CREATION.SERVICE.Interfaces.INewDatabaseService
Lifetime: Scoped ImplementationType:
JobsLedger.DATABASE.CREATION.SERVICE.NewDatabaseService': Unable to
resolve service for type
'JobsLedger.TENANTS.Repositories.Interfaces.IAccountTENANTSRepository'
while attempting to activate
'JobsLedger.DATABASE.CREATION.SERVICE.NewDatabaseService'.) (Error
while validating the service descriptor 'ServiceType:
JobsLedger.DATABASE.CREATION.SERVICE.Interfaces.ITenantAndAccountInitialisations
Lifetime: Scoped ImplementationType:
JobsLedger.DATABASE.CREATION.SERVICE.TenantAndAccountInitialisations':
No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.TENANTS.TENANTSContext Lifetime: Scoped ImplementationType:
JobsLedger.TENANTS.TENANTSContext': No constructor for type
'JobsLedger.TENANTS.TENANTSContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.DATAContext Lifetime: Scoped ImplementationType:
JobsLedger.DATA.DATAContext': No constructor for type
'JobsLedger.DATA.DATAContext' can be instantiated using services from
the service container and default values.) (Error while validating the
service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.IBrandDATARepository Lifetime:
Scoped ImplementationType:
JobsLedger.DATA.Repositories.BrandDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.IClientDATARepository
Lifetime: Scoped ImplementationType:
JobsLedger.DATA.Repositories.ClientDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.ICounterDATARepository
Lifetime: Scoped ImplementationType:
JobsLedger.DATA.Repositories.CounterDATARepository': No constructor
for type 'JobsLedger.DATA.DATAContext' can be instantiated using
services from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.IJobDATARepository Lifetime:
Scoped ImplementationType:
JobsLedger.DATA.Repositories.JobDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.ILoggingDATARepository
Lifetime: Scoped ImplementationType:
JobsLedger.DATA.Repositories.LoggingDATARepository': No constructor
for type 'JobsLedger.DATA.DATAContext' can be instantiated using
services from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.INoteDATARepository Lifetime:
Scoped ImplementationType:
JobsLedger.DATA.Repositories.NoteDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.INoteTypeDATARepository
Lifetime: Scoped ImplementationType:
JobsLedger.DATA.Repositories.NoteTypeDATARepository': No constructor
for type 'JobsLedger.DATA.DATAContext' can be instantiated using
services from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.IStateDATARepository Lifetime:
Scoped ImplementationType:
JobsLedger.DATA.Repositories.StateDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.IStatusDATARepository
Lifetime: Scoped ImplementationType:
JobsLedger.DATA.Repositories.StatusDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.ISuburbDATARepository
Lifetime: Scoped ImplementationType:
JobsLedger.DATA.Repositories.SuburbDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.ITypeDATARepository Lifetime:
Scoped ImplementationType:
JobsLedger.DATA.Repositories.TypeDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.DATA.Repositories.Interfaces.IVisitDATARepository Lifetime:
Scoped ImplementationType:
JobsLedger.DATA.Repositories.VisitDATARepository': No constructor for
type 'JobsLedger.DATA.DATAContext' can be instantiated using services
from the service container and default values.) (Error while
validating the service descriptor 'ServiceType:
JobsLedger.TENANTS.Repositories.Interfaces.ITenantTENANTSRepository
Lifetime: Scoped ImplementationType:
JobsLedger.TENANTS.Repositories.TenantTENANTSRepository': No
constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.TENANTS.Repositories.Interfaces.ITenantTENANTSRepository
Lifetime: Scoped ImplementationType:
JobsLedger.TENANTS.Repositories.TenantTENANTSRepository': No
constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.TENANTS.Repositories.Interfaces.ICounterTENANTSRepository
Lifetime: Scoped ImplementationType:
JobsLedger.TENANTS.Repositories.CounterTENANTSRepository': No
constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.TENANTS.Repositories.Interfaces.ISuburbTENANTSRepository
Lifetime: Scoped ImplementationType:
JobsLedger.TENANTS.Repositories.SuburbTENANTSRepository': No
constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.TENANTS.Repositories.Interfaces.IStateTENANTSRepository
Lifetime: Scoped ImplementationType:
JobsLedger.TENANTS.Repositories.StateTENANTSRepository': No
constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.API.CONTROLLER.SERVICES.API.App.ClientService.Interfaces.IClientServices
Lifetime: Scoped ImplementationType:
JobsLedger.API.CONTROLLER.SERVICES.API.App.ClientService.ClientServices':
No constructor for type 'JobsLedger.DATA.DATAContext' can be
instantiated using services from the service container and default
values.) (Error while validating the service descriptor 'ServiceType:
JobsLedger.API.CONTROLLER.SERVICES.API.App.JobService.Interfaces.IJobServices
Lifetime: Scoped ImplementationType:
JobsLedger.API.CONTROLLER.SERVICES.API.App.JobService.JobServices': No
constructor for type 'JobsLedger.DATA.DATAContext' can be instantiated
using services from the service container and default values.) (Error
while validating the service descriptor 'ServiceType:
JobsLedger.API.CONTROLLER.SERVICES.Authorisation.Interfaces.IAccountService
Lifetime: Scoped ImplementationType:
JobsLedger.API.CONTROLLER.SERVICES.Authorisation.AccountService':
Unable to resolve service for type
'JobsLedger.TENANTS.Repositories.Interfaces.IAccountTENANTSRepository'
while attempting to activate
'JobsLedger.API.CONTROLLER.SERVICES.Authorisation.AccountService'.)
(Error while validating the service descriptor 'ServiceType:
JobsLedger.API.CONTROLLER.SERVICES.Common.Interfaces.IAddressDropdownServices
Lifetime: Scoped ImplementationType:
JobsLedger.API.CONTROLLER.SERVICES.Common.AddressDropdownServices':
Unable to resolve service for type
'JobsLedger.INTERFACES.IUserSession' while attempting to activate
'JobsLedger.API.CONTROLLER.SERVICES.Common.AddressDropdownServices'.)
(Error while validating the service descriptor 'ServiceType:
JobsLedger.DATABASE.CREATION.SERVICE.Interfaces.ITenantAndAccountInitialisations
Lifetime: Scoped ImplementationType:
JobsLedger.DATABASE.CREATION.SERVICE.TenantAndAccountInitialisations':
No constructor for type 'JobsLedger.TENANTS.TENANTSContext' can be
instantiated using services from the service container and default
values.)
Here is my Migration.cs class that is the design time factory:
public DesignTimeTENANTSContextFactory(IDbConnectionString connectionString)
{
_connectionString = connectionString;
}
public TENANTSContext CreateDbContext(string[] args)
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
var builder = new DbContextOptionsBuilder<TENANTSContext>();
var connectionString = configuration.GetConnectionString("CatalogConnection");
builder.UseSqlServer(connectionString);
return new TENANTSContext(builder.Options);
}
}
Its using a parameterless constructor in the TENANTSContext which is detailed below:
public class TENANTSContext : DbContext
{
private readonly HttpContext _httpContext;
// Constructors..
public TENANTSContext(DbContextOptions<TENANTSContext> options)
: base(options)
{ }
public TENANTSContext(DbContextOptions<TENANTSContext> options, HttpContext httpContext) : base(options)
{
_httpContext = httpContext;
}
public DbSet<Tenant> Tenants { get; set; }
......
So why am I getting the above error. I am also following this documentation This says it doesnt use application services and instead uses a designTimeFactory which is exactly what I am using so why is it complaining about all the services that cannot be instatiated etc.
Also, what does it mean by:
No parameterless constructor defined for type 'JobsLedger.API.DesignTimeTENANTSContextFactory'.
Basically what's wrong and how do I correct it?

Related

Kong set Service timeouts via Helm Charts

I am trying to set the Timeouts for my Kong Service, which is deployed with Helm Charts.
In my Service.yaml file I added these annotations, as referenced in the Kong Docs.
annotations:
konghq.com/connect-timeout: 120000
konghq.com/write-timeout: 120000
konghq.com/read-timeout: 120000
However in the deployment Process I get the following error:
> Error: unable to build kubernetes objects from release manifest: unable to decode "": json: cannot unmarshal number into Go struct field ObjectMeta.metadata.annotations of type string
Okay the answer is simply pass the values as strings.
annotations:
konghq.com/connect-timeout: "120000"
konghq.com/write-timeout: "120000"
konghq.com/read-timeout: "120000"

Tekton dashboard deployment error- Error from server (Forbidden): error when creating "config/service.yaml"

I am trying to practice the steps in my local using minikube. From the teokton-dashboard in my local I am able to import the resource using git url. I followed all the steps but when creating pipeline runs I am getting error as Error from server (Forbidden): error when creating "config/service.yaml". I tried using default namespace as well as tekton-pipeline namespace. I used tekton-dashboard as serviceAccount.
[![Error from server (Forbidden): error when retrieving current configuration of:
Resource: "apps/v1, Resource=deployments", GroupVersionKind: "apps/v1, Kind=Deployment"
Name: "myapp", Namespace: "tekton-pipelines"
from server for: "config/deployment.yaml": deployments.apps "myapp" is forbidden: User "system:serviceaccount:tekton-pipelines:tekton-dashboard" cannot get resource "deployments" in API group "apps" in the namespace "tekton-pipelines"
Error from server (Forbidden): error when creating "config/service.yaml": services is forbidden: User "system:serviceaccount:tekton-pipelines:tekton-dashboard" cannot create resource "services" in API group "" in the namespace "tekton-pipelines"][1]][1]
Attaching screenshots for reference

kubernetes nginx.ingress multiple websocket services

How I can specify more that one service for the nginx ingress websocket annotation?
nginx.ingress.kubernetes.io/websocket-services: "service-name"
the name implies more that one service can be supplied?
NGINX Ingress WebSocket support page says:
To load balance a WebSocket application with NGINX Ingress
controllers, you need to add the nginx.org/websocket-services(you use nginx.ingress.kubernetes.io)
annotation to your Ingress resource definition. The annotation
specifies which services are websocket services. The annotation syntax
is as follows:
nginx.org/websocket-services: "service1[,service2,...]"
So nginx.org/websocket-services: "service-name,service-name1,..,service-nameN"

How to define a static ClusterIP in Kubernetes?

I know we can set Public-IP as a static if we define LoadBalancer but can we set a static Cluster IP for service?
Example:
**NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE**
service/my-application-service ClusterIP 10.111.67.245 <none> 80/TCP 11d
It looks like you can specify the clusterIP field under spec on a ClusterIP kind service.
Example:
apiVersion: v1
kind: Service
metadata:
name: myawesomeservice
namespace: myawesomenamespace
spec:
clusterIP: 10.43.11.51
...
Most relevant snippet from docs
"If an address is specified manually, is in-range (as per system configuration), and is not in use, it will be allocated to the service; otherwise creation of the service will fail" - https://kubernetes.io/docs/reference/kubernetes-api/services-resources/service-v1/
And here is the full paragraph.
spec
clusterIP (string)
clusterIP is the IP address of the service and is usually assigned
randomly. If an address is specified manually, is in-range (as per
system configuration), and is not in use, it will be allocated to the
service; otherwise creation of the service will fail. This field may
not be changed through updates unless the type field is also being
changed to ExternalName (which requires this field to be blank) or the
type field is being changed from ExternalName (in which case this
field may optionally be specified, as describe above). Valid values
are "None", empty string (""), or a valid IP address. Setting this to
"None" makes a "headless service" (no virtual IP), which is useful
when direct endpoint connections are preferred and proxying is not
required. Only applies to types ClusterIP, NodePort, and LoadBalancer.
If this field is specified when creating a Service of type
ExternalName, creation will fail. This field will be wiped when
updating a Service to type ExternalName. More info:
https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
src: https://kubernetes.io/docs/reference/kubernetes-api/services-resources/service-v1/

Kubernetes load balancing

I'm studing Kubernetes (with no regard of a specific Cloud Provider) and it's not so clear if the most generic Service (not the Service of type Load-Balancer) works as an internal load balancer among the various replicas of a single microservice.
So how to implement internal load balancing among replicas without exposing the microservice to the outside traffic?
You can use kubernetes service object which is top of the pod.
Service object manage the connection and traffic it can be also used as internal load balancer.
You can create service with yaml file
kind: Service
apiVersion: v1
metadata:
name: myapp-service
spec:
selector:
app: Myapp
ports:
- port: 80
targetPort: 9376
On the base of the same selector in pod metadata to divert the traffic to that pods.
Just use proper selector in specs section inside service and pods.
in order to create an internal load balancer , you will need to create a service based on selectors in order to find the correct pod to direct the traffic.
in order for the pod to be blocked for outside traffic it should be of type ClusterIP.