skip to Main Content

I have a skaffold.yamlfile like below:

apiVersion: skaffold/v2alpha3
kind: Config
deploy:
  mk:
    manifests:
      - ./infra/k8s/*
build:
  local:
    push: false
  artifacts:
    - image: learnertester/auth
      context: auth
      docker:
        dockerfile: Dockerfile
      sync:
        manual:
          - src: 'src/**/*.ts'
            dest: .
    - image: learnertester/ticketing-client

Now, I have installed microk8s on Ubuntu 22.04 and want to use it. I have also defined an alias mk for microk8s kubectl. But when I change the following line:

deploy:
  kubectl:

To:

deploy:
  mk:

I get the below error running skaffold dev:

parsing skaffold config: error parsing skaffold configuration file: unable to parse config: yaml: unmarshal errors:
  line 55: field mk not found in type v2alpha3.DeployConfig

How should I fix that?

2

Answers


  1. As per this doc , use deploy as microk8s kubectl instead mk.
    This might not be taking the alias mk or else you have not done a proper alias.

    add an alias (append to ~/.bash_aliases) like this:
    alias kubectl=’microk8s kubectl’

    Then use as below and have a try :

    deploy:
      microk8s kubectl:
    

    Refer to this skafold.yaml doc for more information on yaml and also you need to use the correct dest path (#destination path in the container where the files should be synced to..)

    You can also check out Cloud Code for IntelliJ and VS Code or the online Cloud Shell Editor which provides skaffold.yaml editing assistance, including highlighting errors in the file.

    Login or Signup to reply.
  2. I face the same problem:

    apiVersion: skaffold/v2alpha3
    kind: Config
    deploy:
      microk8s kubectl:
      manifests:
        - ./infra/k8s/*
    

    ……

    "Property microk8s kubectl is not allowed.yaml-schema: skaffold.yaml"

    I found this solution from here:
    https://github.com/GoogleContainerTools/skaffold/issues/5283

    Ubuntu 20.04 Server – microk8s Kubernetes – old laptop as a server

    . Undo alias commented or delete the line:
    # alias kubectl=’microk8s kubectl’

    nano ~/.bashrc
    nano ~/.bash_aliases
    

    . Install kubectl and export config

     sudo snap install kubectl --classic
     microk8s.kubectl config view --raw > $HOME/.kube/config
     New config file created in my case....ls $HOME/.kube/
    

    . scaffold.yaml infra/k8s the path for all .yaml files

      apiVersion: skaffold/v4beta1
      kind: Config
      manifests:
      rawYaml:
        - ./infra/k8s/*
    

    .yaml for reference

    apiVersion: skaffold/v3alpha1
    kind: Config
    build:
      artifacts:
        - image: ajochope/auth
          context: auth
          docker:
            dockerfile: Dockerfile
          sync:
            manual:
              - src: "src/**/*.js"
                dest: .
    manifests:
      rawYaml:
      - ./infra/k8s/*
    deploy:
      kubectl: {}
    

    Cheers!!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search