No description
  • TypeScript 97.6%
  • JavaScript 2.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] bbdce8da3e
Some checks failed
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Run prettify / Prettier Check (push) Has been cancelled
Unit Tests / Run Unit Tests (push) Has been cancelled
chore(deps): bump js-yaml from 4.3.1 to 4.3.2 (#288)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.3.1 to 4.3.2.
- [Changelog](https://github.com/nodeca/js-yaml/blob/4.3.2/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.3.1...4.3.2)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-10 11:07:12 -07:00
.github chore(deps): bump actions/stale in /.github/workflows (#285) 2026-09-10 10:51:11 -07:00
.husky chore: move husky to devDependencies, add version sync pre-commit hook (#243) 2026-05-06 11:03:39 -07:00
src fix(run): quiet expected 404 and surface real errors on delete (#272) 2026-07-15 17:08:16 -04:00
test migrate project to ESM with esbuild and vitest (#238) 2026-04-15 13:42:22 -07:00
.gitignore Removed lib/ and added lib/ to .gitignore. (#53) 2022-02-03 16:38:17 -05:00
.npmrc chore: enforce 7-day dependency freshness period and check signed commits (#282) 2026-08-17 12:06:18 -04:00
.prettierignore Enforce Prettier (#71) 2022-06-29 12:33:34 -04:00
.prettierrc.json Enforce Prettier (#71) 2022-06-29 12:33:34 -04:00
action.yml Update Node.js runtime from node20 to node24 (#229) 2026-03-12 16:29:50 -07:00
CHANGELOG.md Release v6.0.1 (#268) 2026-06-22 18:12:51 -07:00
CODE_OF_CONDUCT.md Security: remove updated action and fix prettier (#132) 2025-02-10 15:02:21 -08:00
esbuild.config.mjs migrate project to ESM with esbuild and vitest (#238) 2026-04-15 13:42:22 -07:00
LICENSE Initial commit 2019-09-04 03:25:31 -07:00
package-lock.json chore(deps): bump js-yaml from 4.3.1 to 4.3.2 (#288) 2026-09-10 11:07:12 -07:00
package.json chore(deps-dev): bump the minor-and-patch group across 1 directory with 4 updates (#286) 2026-09-10 10:51:20 -07:00
README.md chore: enforce 7-day dependency freshness period and check signed commits (#282) 2026-08-17 12:06:18 -04:00
SECURITY.md Security: remove updated action and fix prettier (#132) 2025-02-10 15:02:21 -08:00
tsconfig.json migrate project to ESM with esbuild and vitest (#238) 2026-04-15 13:42:22 -07:00
vitest.config.ts migrate project to ESM with esbuild and vitest (#238) 2026-04-15 13:42:22 -07:00

Kubernetes create secret

Create a generic secret or docker-registry secret in Kubernetes cluster, replacing the secret if it already exists.

The secret will be created in the cluster context which was set earlier in the workflow by using either azure/aks-set-context or azure/k8s-set-context

Refer to the action metadata file for details about all the inputs https://github.com/Azure/k8s-create-secret/blob/master/action.yml

For docker-registry type secrets, the fields .dockercfg or .dockerconfigjson can be supplied in plaintext on the string-data JSON object, or base64 encoded on the data JSON object as included in the docker-config-secrets section.

Sample workflow for docker-registry secret (imagepullsecret, stringData)

# File: .github/workflows/workflow.yml

on: push

jobs:
   example-job:
      runs-on: ubuntu-latest
      steps:
         - name: Set imagePullSecret
           uses: azure/k8s-create-secret@v6
           with:
              namespace: 'myapp'
              secret-name: 'contoso-cr'
              container-registry-url: 'containerregistry.contoso.com'
              container-registry-username: ${{ secrets.REGISTRY_USERNAME }}
              container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
           id: create-secret

Sample workflow for generic secret (base64 data)

# File: .github/workflows/workflow.yml

on: push

jobs:
   example-job:
      runs-on: ubuntu-latest
      steps:
         - uses: azure/k8s-create-secret@v6
           with:
              namespace: 'default'
              secret-type: 'generic'
              secret-name: azure-storage
              data: ${{ secrets.AZURE_STORAGE_ACCOUNT_DATA }}

Alternative for Container Registry Secrets

Get the username and password of your container registry and create secrets for them. For Azure Container registry refer to admin account document for username and password.

For creating docker-registery secrets, kubectl can generate the JSON

kubectl create secret docker-registry secret-tiger-docker \
  --docker-username=tiger \
  --docker-password=pass113 \
  --docker-email=tiger@acme.com \
  --docker-server=my-registry.example:5000

Example output:

{
    "apiVersion": "v1",
    "data": {
        ".dockerconfigjson": "eyJhdXRocyI6eyJteS1yZWdpc3RyeTo1MDAwIjp7InVzZXJuYW1lIjoidGlnZXIiLCJwYXNzd29yZCI6InBhc3MxMTMiLCJlbWFpbCI6InRpZ2VyQGFjbWUuY29tIiwiYXV0aCI6ImRHbG5aWEk2Y0dGemN6RXhNdz09In19fQ=="
    },
    "kind": "Secret",
    "metadata": {
        "creationTimestamp": "2021-07-01T07:30:59Z",
        "name": "secret-tiger-docker",
        "namespace": "default",
        "resourceVersion": "566718",
        "uid": "e15c1d7b-9071-4100-8681-f3a7a2ce89ca"
    },
    "type": "kubernetes.io/dockerconfigjson"
}

Testing

Unit tests are run with Vitest and can be found in the ./test directory

Integration tests use Minikube and are executed within workflows in ./github/workflows

Dependencies

This repository enforces a 7-day dependency freshness ("bake") period: newly published npm packages are not adopted until they have been available for at least 7 days, giving the ecosystem time to catch broken or malicious releases.

  • Dependabot uses a 7-day cooldown and opens PRs on the 1st and 15th of each month, grouping minor/patch updates into a single PR. Major updates are still raised individually so they get their own review.
  • .npmrc sets min-release-age=7 (days), which applies the same rule to local npm install. This requires npm >= 11.10.0; the version bundled with Node 24 (this action's runtime) satisfies that. On older npm the setting is ignored, so Dependabot's cooldown remains the authoritative control.

Security exception: to adopt an urgent patch that is less than 7 days old, install it once with the age check disabled:

npm install <pkg> --min-release-age=0

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Support

k8s-create-secret is an open source project that is not covered by the Microsoft Azure support policy. Please search open issues here, and if your issue isn't already represented please open a new one. The project maintainers will respond to the best of their abilities.