.Net | Platform | State |
---|---|---|
4.5.2 | x64 |
Install-Package KubernetesService
dotnet add package KubernetesService
paket add KubernetesService
//Creating user configuration provider
IConfigurationProvider confProvider = new CConfigurartionProviderUserProfile();
//Creating authentication provider
IAuthenticationProvider authProv = new CSSLAuthenticationProvider(confProvider);
//Creating service instance and connecting
CKubernetesService service = CKubernetesService.Connect(new Uri("https://<you_cluster_here>"), authProv);
var retVal = service.Service.ListAppsV1beta1NamespacedDeployment("default");
service.Dispose()
Current version implements common authentification scenario.
- Reading configuration from %USERPROFILE%.kube\config
- Establishing a SSL connection to REST API endpoint
For extending authentification functionality you have to implement two interfaces
- Reading client configuration (ex. file, http,)
public interface IConfigurationProvider
{
CKubernatesConfig GetConfiguration();
}
- Applying configuration to underlying HttpClientHandler. Kubernetes offcially support SSL/TLS, user\password pair, OAuth token Currently implemented SSL/TLS in this realese. Other scenarios planned for future
public interface IAuthenticationProvider
{
IConfigurationProvider ConfigurationProvider { get; }
void ApplyConfiguration(Uri endPoint, WebRequestHandler handler);
}
Note: parameter Uri endPoint have exactly match cluser endpoint for configuration
All question you can address to project's mailing list