diff --git a/src/config.ts b/src/config.ts index 2ec81d364a..92a4292f38 100644 --- a/src/config.ts +++ b/src/config.ts @@ -142,7 +142,7 @@ export class KubeConfig implements SecurityAuthentication { public loadFromFile(file: string, opts?: Partial): void { const rootDirectory = path.dirname(file); - this.loadFromString(fs.readFileSync(file, 'utf8'), opts); + this.loadFromString(fs.readFileSync(file).toString('utf-8'), opts); this.makePathsAbsolute(rootDirectory); } @@ -323,7 +323,7 @@ export class KubeConfig implements SecurityAuthentication { const namespaceFile = `${pathPrefix}${SERVICEACCOUNT_NAMESPACE_PATH}`; let namespace: string | undefined; if (fileExists(namespaceFile)) { - namespace = fs.readFileSync(namespaceFile, 'utf8'); + namespace = fs.readFileSync(namespaceFile).toString('utf-8'); } this.contexts = [ {